Ubuntu: Fixing permissions of backup files that I don't have -r or -w access to - but still denied access


I've always used rsync to backup all my files to an external drive. Now after having formatted my hard disk and reinstalled Linux, I wanted to copy the backup files to my hard disk.

The problem is that all my backup files on my external drive are somehow set to 'only owner has rw permissions', and I'm not recognized as the owner anymore. I.e. the directories and files are drwx------ and I can't even cd into them, not even as sudo.

I could at least, using sudo cp, copy directories to my hard drive. But they still have the same permissions. I tried to fix permissions with chmod, and can change them to drwxrw-rw- apparently, but still are denied access to them.

~/Desktop $ sudo cp -r /media/lb79/EXTHD/LB7979/Google\ Drive/Pictures/2013 ~/Desktop  ~/Desktop $ ls -gG  total 16  drwx------ 5 12288 Sep 23 17:41 2013  drwx------ 6  4096 Sep 23 17:37 2014  ~/Desktop $ sudo chmod a+rw 2013  ~/Desktop $ ls -gG  total 16  drwxrw-rw- 5 12288 Sep 23 17:41 2013  drwx------ 6  4096 Sep 23 17:37 2014  ~/Desktop $ cd 2013  bash: cd: 2013: Permission denied  ~/Desktop $  

So, how can I change permissions so that I have read and write access again?

Also, how to set up rsync parameters so that when I run my next backup, I retain -rw rights to my own files? I always used

rsync -rltpv  

because I thought the -p stood for retain permissions, but that worked out differently than expected...


Try the following:

sudo chown -R username:username <directory with your files>  

This will transfer the ownership of these files to you, so you can use them again.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »