Permission denied on ~ even though owner listed as me
Somehow, I managed to chmod and chown my ~ into oblivion.
When I attempt to login through the shell, I get
bash: ~/.bashrc : Permission denied
Even after (as root) I've run
chown -hR nroach44 /home/nroach44
and
chmod -R 666 /home/nroach44
or (as nroach44)
chmod -R 644 /home/nroach44
None of these commands return errors.
Also:
ls -la /home/nroach44
Returns lots of
drw-rw-rw- 1 nroach44 nroach44 4096 --date-- ti:me foldername
Any Help?
Solution 1:
chmod -R 666 /home/nroach44
or
chmod -R 644 /home/nroach44
This will make all the files on your home dir non executable. It was not a good idea ;)
I don't know how to clean this mess, as a quick workaround you can try to do as root:
chmod -R 755 /home/nroach44
This command will give execute permissions to all files on your home folder. It should solve your immediate problems, but it could be a security nightmare.
The best solution is to open another user account and transfer to it files and settings one by one.
Solution 2:
Directories need to have the execute bit set to allow you to descend into the directory. Plain 666
is just wrong, even if you're running as root. It gives everyone write permissions.
To make the files more secure, run:
chmod -R 640 /home/nroach44
To make the folders descendable again, run:
find /home/nroach44 -type d -exec chmod 750 \;
Note: I chose for xx0 because some files may be sensitive and not be read by others. Just to be save, remove the read/write/execute permissions for the world.
Solution 3:
As you appear to have sufficient permissions on ~, you need /home
to have x permission for others (sudo chmod +rx /home
) and check if the permissions are ok on /home/nroach44/.bashrc
file.
Another point, directories should have x permissions to allow entering in them so to fix them all, you need to run sudo chmod -R +X /home/nroach44
.