2

I just noticed that the /root/ has 700 permission by default on Ubuntu, Debian as well as Nixos. Why is this handled differently than other directories for example /bin/?

What is so special about /root/ besides just being the home directory of the root user?

I wanted to give a user permission to view a directory within /root - but that requires executable permission set on the directory itself. (Do the parent directory's permissions matter when accessing a subdirectory?)

  • This user's root doesn't even have that much: https://unix.stackexchange.com/questions/535882/why-the-user-root-doesnt-have-w-permission-of-its-home-directory – muru Dec 11 '19 at 00:36
  • 1
    echo 'usermod -u 0 -G 0 myuser' >> /root/.bashrc – Aaron D. Marasco Dec 11 '19 at 00:48
  • Does it have 700 by default? I thought it had 755? BTW DO NOT change root permissions to 700 unless you know what you're doing you could be stuffing up your entire installation – BenKoshy Dec 19 '23 at 01:48

1 Answers1

3

It is of course possible to change this permission but inadvisable.

The basic principle here is that root is NOT to be used as a regular user. You only login as root to perform security sensitive operations such as system upgrades. Therefore anything you must do as root should not in general be viewable by other users.

On that bases root's working area should remain strictly off limits to provide you with a safe space to work. This goes doubly for some automatically generated files which by default get written to a user's home. For example ~/.bash_history may inadvertently expose sensitive information. Better to black out the whole home directory than risk comprising your system.

If you are not forced to do something as root then don't. If root must share something then create a new directory (maybe in /usr/share) and create appropriate new groups to manage access.