Copying files in Perl throws permission error

GoWilkes

Well-Known Member
Sep 26, 2006
703
34
178
cPanel Access Level
Root Administrator
Is there a cPanel-related reason why using File::Copy or File::Copy::Recursive within Perl throws an error that permission is denied?

I've been working on this for two days and can't find a reason why it's not working, the only thing I can think is maybe there's a security setting on the server somewhere.

I'm using 106.0.9 on CentOs v7.9.2009, and all of the files I'm testing with are owned by root/root and permission is 0755
 

rbairwell

Well-Known Member
May 28, 2022
117
49
28
Mansfield, Nottingham, UK
cPanel Access Level
Root Administrator
Where are you copying the files to? If the destination isn't writable by the user the script is running as, then it'll throw "permission denied" as well. I take it the script is being run by root. Can you copy the files manually between the locations using "cp source destination"?

I would try just copying /home/username/filea.txt to /home/username/fileb.txt with a script in /home/username/ created by and running the script as "username" (yes, "username" can be root and use /root/ if you want): if that fails, it indicates an underlying problem. If it succeeds, then try copying from the original location to fileb.txt (which will confirm the "readability" of the source file) and then try copying filea.txt to the original destination.
 

GoWilkes

Well-Known Member
Sep 26, 2006
703
34
178
cPanel Access Level
Root Administrator
Thanks for the reply! I figured out the problem, I had to change all permissions to 777 instead of 755.

On my old server, root/root could do anything so I had all writable directories set to 755. I'm not sure if there's a setting somewhere on my new server, or if it's related to the Perl update that came along with the transition, but at some point I guess this changed.