I am trying to copy files from one user’s home directory to another user’s home directory in PYTHON. Problem is I get access denied due to the user permissions. Is there a way to elevate the permissions in linux for the PYTHON user?
I tried copying files using distutils.file_util.copy_file() and shutil.copyfile() but I get: [Errno 13] Permission denied: ‘/home/testuser/test.txt’ any ideas?
There is no PYTHON user, your Python process will be run with the permissions of the user who executed the script. If you need to run your script with different permissions use sudo to run the script as root or some other user that has read permission on the source directory and write permission on the destination.