For the record, here's the commands to reset the permissions (leaving all execute flags off, which may not be what you want).
Warning, this could have undesired side effects. If you have executable files in your home folder that you actually want to be executable, you will have to manually mark them as executable again.
My latest use for this was after extracting files from my p910i with p3nfs, which as with so many desktop/device tasks needed root to work.
# Become root (as you don't currently have permissions to modify your own files)
sudo -i
# Reset ownership & group to yourself
chown -R tim:tim /home/tim
# give yourself the default read-write permissions, set group and other to read only
chmod -R 644 /home/tim
# re-apply excecute permissions on all the directories
find /home/tim -type d -print0 | xargs -0 -II chmod 755 'I'
# Don't leave your private keys showing:
chmod -R 700 /home/tim/.ssh
My latest use for this was after extracting files from my p910i with p3nfs, which as with so many desktop/device tasks needed root to work.
You could do this slightly more neatly if you know what permissions you have ended up with by using chmod u+w etc so you don't have to re-apply directory permissions, but I wanted to easily guarantee permissions are right regardless of what state they have ended up in.
It occurs to me it might be sensible to set the sticky bit on the home folders so that anything added by root stays owned by the user. (chmod u+s g+s /home/tim)
8 comments:
in your command examples you use the term targer-folder.
there's no such thing as targer-folder.
What you mean is target-folder and it really is a paramater of the folder you want to target.
So, your example is in bad form though it may have substance.
Next it isn't proper that you do this without explanation. How will this affect the folder. What if you do this to the user folder itself? Why didn't you execute the command using sudo instead of sudo -i (which can be dangerous)?
What sort of side effects are we going to encounter and how do we undo this if things go awry?
It is best that you always provide answers and of course warnings if anything could possibly go bad here.
Cheers for that.. :-)
Feel like a bit of an eejit for locking myself out.. guess im not the only one though!
Thanks, -Harry
For the record I just removed a comment criticising "The Real Take"'s comment for not contributing anything meaningful.
It has been removed because of the unseemly language used which I won't tolerate here.
As it happens I think The Real Takes's criticisms are valuable, as they alert readers to the broader picture which I hadn't alluded to in my quick posting.
Thanks alot for this, I was having a lot of problems with various software not working as normal user, resetting the permissions did the trick!
Thank you! This worked just as I needed after copying folders and files I had backed up from another computer!
thanks a lot.. the guide helped me a lot in resetting home dir permissions:)
Thanks for this, just what I needed.
`targer-folder` removed to avoid confusion. Thanks "The Real Take"
Post a Comment