How can I change the permission on my folder so I could log in

Asked by emfyoh4

I was trying to make my folder inaccessible to other users so I changed the permissions to list files only but now I cannot log in to my own user name. How could I change the permission to where it were before if I could not log in to my own user login

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Jonathan Clarke
Solved:
Last query:
Last reply:
Revision history for this message
Jonathan Clarke (jooooooon) said :
#1

I presume you cannot log in using the usual graphical interface since you changed permissions.

You should be able to change permissions again by logging in on a console. Press Alt+Ctrl+F1 and you should have a text invite. Type in your username and password, then use sudo to perform reverse chmod/chown operations to the ones that lead you here. Then, press Alt+Ctrl+F7 to get back to the graphical login invite, and you all should be corrected.

Hope this helps.

Revision history for this message
emfyoh4 (emfyoh4) said :
#2

I'm just a novice to this so how do you perform reverse chmod/chown operation. When I use chown, it says it cannot find it. Does this means that everything has been deleted? I find that because I'm the administrator, I can access any other user but I cannot access mine nor login to it. If chmod changes everything back to the original, how do I do this. I actually changed all this permission on the file system/home/myfolder.

Revision history for this message
Jim Hutchinson (jphutch) said :
#3

It might help to know what you did when made the change. What command did you run and on what files and dirs? If you ran some recursively on your home directory you will probably end up reinstalling as it's very hard to get everything back to normal. I think Ubuntu should ship with a big warning message saying never change permissions except on individual files when it's necessary.

Quick tutorial:

chown means change owner and is used like this -

chown user:group /path/to/file

If you don't own the file you can't chown it unless you use sudo

chmod means change mode (i.e. permissions) and uses either numbers referring to the permission levels or can use characters like e or executable or r for writeable, etc. and is used like this

chmod 777 /path/to/file

That would make it read/writable for everyone.

or

chmod +x /path/to/file

to make something executable. Check a site like http://www.linuxforums.org/security/file_permissions.html for more information.

Again, you would need sudo if you don't own the file or have write permissions.

If you can't use commands you may have really done a number on things. You can try booting recovery mode which gives you a root shell and you can try to undo the changes but if you don't know what the permissions were before you changed them it's hard to figure out what they should be - depending of course on what you changed.

If you can share what you did we may be able to help you undo or suggest an alternative solution. Depending on the degree of damage a reinstall may be the best course. It seems everyone sooner or later does this and learns the hard way. I know I did.

Revision history for this message
Best Jonathan Clarke (jooooooon) said :
#4

If you didn't change the owner of your home directory then you just need to use chmod and not chown.

If you only changed permissions on your home directory (and not any items beneath it) then this command will do:
chmod 755 /home/<yourusername>

Revision history for this message
emfyoh4 (emfyoh4) said :
#5

Thank you guys, I just reinstalled Ubuntu as everything is beyond me. 1st lesson in Ubuntu learned.

emfyoh4

Revision history for this message
emfyoh4 (emfyoh4) said :
#6

Thanks Jonathan Clarke, that solved my question.