Introduction
Sometimes when attempting to transfer account via Transfer Tool, you will receive permission denied errors from rsync such as the following:
rsync: opendir "/home/cpanel/.trash/new_file" failed: Permission denied (13)
As the packing process is run as the account user, this usually means that the user running the command does not have correct permissions or ownership over the file specified.
Procedure
This can be checked with the stat command where you can see that the user and group are not set to the correct user(cpanel):
[22:23:13 cpanel root@server ~]cPs# stat /home/cpanel/.trash/new_file
File: ‘/home/cpanel/.trash/new_file’
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 803h/2051d Inode: 58721379 Links: 24
Access: (0700/drwx------) Uid: ( 99/ nobody) Gid: ( 99/ nobody)
Access: 2020-08-15 02:38:26.891604638 +0200
Modify: 2019-12-17 18:44:12.000000000 +0100
Change: 2020-01-09 02:33:40.488627659 +0100
Birth: -
This can be resolved by correcting the user/group with the chown command.
Be sure to replace cpanelusername below with the username of the relevant cPanel user that should own the file.
chown cpanelusername:cpanelusername /home/cpanelusername/.trash/new_file
In the case of many files having this issue you may use the find command to locate files that are not using the expected ownership configuration.
For example, the following command will locate any files that are not owned by the cPanel user. In this example, the .htaccess file is owned by the root user which will cause permission errors in the Transfer Tool. Again, be sure to replace cpanelusername with your cPanel username.
[root@srv001 ~]# find /home/cpanelusername/ -not -user cpanelusesrname -ls
1441902 4 -rw-r--r-- 1 root root 151 Sep 25 00:07 /home/cpanelusername/public_html/.htaccess
You can use a similar find command to operate on the same set of files. In the below example we remove the -ls
portion of the command and replace it with -exec
chown cpanelusername:cpanelusername {} \;
This executes the chown command for each of the files that were found. The {}
is replaced with the filename of each found file, and the \;
just indicates the end of the command. Please review the manual for the find command for further information before executing the command. You can learn more by using the following command:
man find
[root@srv001 ~]# find /home/cpanelusername/ -not -user cptest -exec chown cpanelusername:cpanelusername {} \;
Comments
0 comments
Article is closed for comments.