Skip to main content

Copying files in Perl throws permission error

Comments

2 comments

  • rbairwell
    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.
    0
  • GoWilkes
    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.
    0

Please sign in to leave a comment.