chmod 700 /home/$user
chmod 700 /boot /usr/src /lib/modules /usr/lib/modules

I ran these commands and lost access to folders and files. Can anybody help me regain access please?

  • Disregard solved.... Added chmod 755
    – sam
    Mar 11 at 7:29
  • 1
    Solved ? Hmmm... the quick & dirty way. Of course you don't want your system to stay as it is now. BTW, next time you feel the need to play with permissions, learn about getfacl first.
    – MC68020
    Mar 11 at 7:44

3 Answers 3


You must have run these commands as root, which means you're bypassing all the protections the system wants to give you. It's important to say when you've run something as root rather than as an ordinary user. Otherwise we have to guess, and guessing leads to bad assumptions, which leads to wrong answers.

However, given this assumption, and also bearing in mind you haven't said for which files and directories you've lost access, I'm going to guess that this line is the main culprit:

chmod 700 /home/$user

The $user variable is unlikely to be set (perhaps you meant $USER?), so the command is equivalent to

chmod 700 /home

This directory is owned by root and the net effect is that no ordinary user will now be able to see their own files and directories. When you log in you'll be given an error message telling you this. It's important to include details like this in your question.

The fix in this specific situation is as you've discovered:

chmod 755 /home

Nothing was lost here 😂

I see only:

  • access change to DIR type inodes
  • no -R switch was used here so no files were touched
  • no sudo was used so it has been done by root group only or root user


  • 755 for directories with user wide access
  • 750 for user home

chmod (change mode) - command to change file access permissions on Unix systems

Some x7xx rights examples:

  • -rwx------ 700 Only the owner has read, write, run rights

  • -rwxr-xr-x 755 The owner has all rights to the file, the rest only read and run rights.

  • -rwxrwxrwx 777 Everyone has all rights to the file.

  • -rwx--x--x 711 The owner has all rights, the rest just the run right.

  • drwx------ 700 The owner of a directory has full rights to it (directories have a d at the beginning instead of a -).

  • drwxr--r-- 744 The owner has full directory rights, the rest have read rights.

  • -rwsr-xr-x 4755 The owner has full rights to the file, the group has read and execute rights, the rest have read and run rights. The file has an SUID attribute (the first digit in the options is equal to 4). This means that the executable file, for example, calls the process and gives it control over the execution of the task. Without the SUID option, the process runs with the privileges of the user who started the file, which can sometimes cause the task to fail because the user didn't have enough privileges. With the SUID option, the process takes the permissions of the owner of the file, usually root. The ping command and executable file permissions are an example of using this option.

  • Remember that chmod allows symbolic permissions too, so it's quite acceptable to say chmod u=rwx,go=rx or in this instance, since we've already got u=rwx set on the file from chmod 700, just chmod go=rx. No need (at this stage) to learn the octal values.
    – roaima
    Mar 11 at 11:13

755 on all those files is waaaay to many permissions.

Run this:

find /usr/lib/modules /usr/src /boot /lib/modules -type d -exec chmod 755 {} ';'
find /usr/lib/modules /usr/src /boot /lib/modules -type f -exec chmod 644 {} ';'
chmod 666 /boot/grub/grub.cfg
chmod 755 /usr/src/linux-headers-*-common/arch/ia64/scripts/check-gas
chmod 755 /usr/src/linux-headers-*-common/arch/ia64/scripts/toolchain-flags
chmod 750 /home/$USER

And please please please be cautions with permissions. You are lucky this is easily salvagable. had you done this to /usr/bin or some other system directories your os would probably have been screwd.

  • 4
    The OP did not use chmod -R. Isn't your fix excessive then? Am I missing something? Mar 11 at 8:15
  • Maybe, maybe not. I am sorry to do so, but with this type of question I usually assume a BDU. Yes, if he did not use -R my solution is exessive. I only saw that he posted his commands properly after looking into the raw text of the original question. I had many users break their systems that way, so I kinda overreacted. If he did not use -R a simpe chmod 755 on those directories is correct, and I am sorry for being a bit on the offensive side.
    – Malik
    Mar 11 at 9:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.