Afterwards I couldn't execute any commands without receiving a 'permission denied' error.

Upon restarting the computer, when I enter my password Ubuntu will look like it's loading for a second but return to the password prompt over and over.

What I did:

  1. Entered root by typing sudo -i
  2. Entered my password
  3. I was trying to edit permissions in my /home folder but I think I changed the wrong directory. I did a chmod -R -x and now my /home has no execute permissions.
  4. Typed su tom
  5. Couldn't execute any commands or log in.

When I tried to type even the simplest command such as cd I was given a permission denied error.

I can't log into my tom user, so I'm on a guest account and don't have access to sudo. When I try to cd /home I get the error bash: cd: /home: Permission denied

  • if my answer is not sufficient, you need to post exactly what it says in the terminal to indicate to you that it is broken. thanks
    – mchid
    Apr 5, 2015 at 0:23
  • You will have to be more specific than saying things like "didn't work" and "broken".
    – psusi
    Apr 5, 2015 at 0:41
  • Thanks for the help guys. I edited the question a bit. Right now I can't log into my tom user and it seems to have lost its password.
    – tfmertz
    Apr 5, 2015 at 1:17
  • If you ran that command on / you will have to reinstall. Boot to recovery mode and try to fix permissions in home.
    – Panther
    Apr 5, 2015 at 1:37
  • Thanks for the tip, I can go into all other folders but my /home
    – tfmertz
    Apr 5, 2015 at 1:38

3 Answers 3


As bodhi.zazen says, you should boot to recovery mode and change the permissions back. Recovery mode should still work fine--this change is unlikely to render it unusable--but if for any reason you cannot use recovery mode, you can use a live CD/DVD/USB.

Hold down shift while booting so the GRUB menu is shown. Select Advanced options for Ubuntu, then select the first entry whose name ends in (recovery mode). Then on the recovery menu, select the option labeled:

root              Drop to root shell prompt

This should give you a # root shell prompt. Remount your / filesystem readwrite by running:

mount -o remount,rw /

(Note that you don't need sudo for that--nor for the chmod commands below--because you are already in a root shell, provided to you by recovery mode.)

Assuming the only changes you made were to execute permissions, you can then simply run:

chmod a+x /home
chmod -R u+X /home/tom

+X sets execute permissions specifically when a file is already executable by some user or a directory (see man chmod for details; note that capital +X is different from +x, which always sets execute permissions). On directories, execute permissions confer the ability to go into the directory. Losing that ability appears to be what has effectively locked you out of your account.

  • Since you just took away executable permissions, there's no need to walk the directory hierarchy with a more complicated find command and identify each file by type to change their permissions. Running chmod recursively with +X will make all the directories "executable" (i.e., enterable) by their owner again, which is precisely what you need here. (There's nothing really wrong with a find-based method, such as the one presented in tfmertz's answer--either way will work fine by itself. And if you happened to do both, what's fine too.)

Then boot normally, either by running reboot or by running exit (which brings you back to the recovery menu) and selecting the resume option.

Those chmod commands won't necessarily put things back to exactly what they were before--for that, it would probably be necessary to see what command you ran (but you may be able to find that by running history after logging back in). However, this will likely be sufficient to enable you to log in and use your Ubuntu system normally again.

This situation, and the solution, is similar to the more common situation where the sole administrator of a system has lost their password. Thus, while you're changing permissions rather than a password and the solution is not exactly the same, you might find it useful to take a look at How do I reset a lost administrative password? Some of the answers there contain screenshots showing how to get a root shell from recovery mode. And if you are unable to access recovery mode, the instructions there (and in this other question) about accessing your system from a live CD/DVD/USB should help.

  • I ran the find commands that @bodhi.zazen linked, hopefully those will work? Right now I am fully functional again, but I'm not sure what permissions still differ from their original settings.
    – tfmertz
    Apr 5, 2015 at 2:18
  • @tfmertz Yes, that should work fine. chmoding with capital +X or using find commands to identify directories and set them executable will both work to enable you to go into your directories again (they'll both reverse the change made by chmoding everything with -x). Either way works by itself but if you happened already to have done both, that's fine too. Apr 5, 2015 at 2:21

The /home folder needs to have its execute permission restored

  1. Restart Ubuntu
  2. Run recovery mode in root (Recovery mode how to)
  3. Run the find commands to restore permissions

Resetting /home permissions

Run both the commands below found from z9.io

For directories only do this

find . -type d -exec chmod 775 {} \;

For files only do this.

find . -type f -exec chmod 664 {} \;

Restart Ubuntu in normal mode and try to log in.


More than an answer is just a comment about this same issue it happened to me just a few minutes back (Jan 26 2016) where I was completing a lab and I entered a chmod 600 ~ command, so I lost access to my home, so I came to this article, and first tried the find commands and the terminal started reading everything, but it all ended in a permission denied result. I went ahead and tried the: chmod a+x /home chmod -R u+X /home/myname

and that resolved it immediately. I was able to start entering cd again.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .