Description

This article describes the issue of the permission denied error message being generated, when copying a file from the secondary node to the primary node.

Symptoms

  • At times, in a chassis cluster, files have to be copied from one node to another.
  • One possible instance is the failure to manage the secondary node via the management interface.
  • In such a case, you have to copy the file from the secondary node to the primary node and then retrieve it. But, when the file is being copied, the following error message is generated:
    {primary:node0}
    Test@SRX3400-50> file copy node1:/var/tmp/node1.log.tgz /var/tmp/
    rcp: /var/tmp/node1.log.tgz: Permission denied
    error: file-fetch failed
    error: could not fetch local copy of file

Solution

This error message is generated, when a user, who is not the owner of the file and does not have permission to read it, logs on to the device.

Take a look at the following configuration excerpt for the Test user:

[edit system]
login {
     user Test {
         uid 200;
         class super-user; < a super-usr
         authentication {
             encrypted-password "$ABC123"; ## SECRET-DATA
         }
     }
}
Permissions on the /var/tmp/node1.log.tgz file:
{secondary:node1}
Test@SRX3400-51> start shell
Test@SRX3400-51% ls -la /var/tmp | egrep ".tar|.tgz"
-rw------- 1 root wheel 352058 Jun 24 06:06 kmdlogs.tar.tgz
-rw-r--r-- 1 root wheel 2043263 Jun 17 13:34 log-rsi.tar.gz
-rw-r--r-- 1 root wheel 2043263 Jun 17 13:35 log1.tar.gz
-rw------- 1 Test wheel 20286017 Jul 29 2012 node0.log.tgz
-rw------- 1 root wheel 14745600 Jul 30 2012 node1.log.tgz <
So, the owner of the file ( node1.log.tgz ) is root and it has permission ( rw- ); group and other users do not have permission for this file. So, when an attempt is made to copy the file via a user, other than root, the error message is generated.

There are two possible solutions for this issue:
 

  • Open a sub-shell as root user and then try to copy the file:
    {primary:node0}
    Test@SRX3400-50> start shell
    Test@SRX3400-50% su
    Password: <<< Enter root user password
    
    {primary:node0}
    Test@SRX3400-50> file copy node1:/var/tmp/node1.log.tgz /var/tmp/
    
  • Change the permissions for the file that has to be copied:
    {secondary:node1}
    Test@SRX3400-51> start shell
    Test@SRX3400-51% ls -la /var/tmp | egrep ".tar|.tgz"
    -rw------- 1 root wheel 352058 Jun 24 06:06 kmdlogs.tar.tgz
    -rw-r--r-- 1 root wheel 2043263 Jun 17 13:34 log-rsi.tar.gz
    -rw-r--r-- 1 root wheel 2043263 Jun 17 13:35 log1.tar.gz
    -rw------- 1 Test wheel 20286017 Jul 29 2012 node0.log.tgz
    -rw------- 1 root wheel 14745600 Jul 30 2012 node1.log.tgz <<<<
    
    Test@SRX3400-51% su
    Password:
    root@SRX3400-51% chmod g+r /var/tmp/node1.log.tgz
    root@SRX3400-51% ls -la /var/tmp/ | grep node1.log.tgz
    -rw-r----- 1 root wheel 2600653 Jul 26 09:23 node1.log.tgz < look at the changes
    
    root@SRX3400-51% exit
    Test@SRX3400-51% exit
    {secondary:node1}
    Test@SRX3400-51> exit
    logout
    rlogin: connection closed
    
    {primary:node0}
    Test@SRX3400-50> file copy node1:/var/tmp/node1.log.tgz /var/tmp/
Now, the group has read permission for this file; so it can be copied by logging in via any user.

Modification History

24/08/23 - applicable to MX series - comment added