/root
the administrator’s home/root is the home directory of the root user. It is not the root of the tree — that is /. It is simply where the administrator’s own files and settings are kept, and it is closed to every other user.
/ is the root directory. /root is root’s home. They are not the same.
Why it exists
Every directory at the top of the tree is there for a reason. This is the problem /root solves.
/home is often a separate partition or a network share. If it fails to mount, root can still log in to repair the system, because root’s home is on the root filesystem.
The administrator’s keys, scripts and history are more sensitive than anyone else’s, so they are not placed beside the other home directories.
What you find inside
Not everything, but the entries worth recognising. Each is marked as a directory, a file, a link or a device.
- .bashrcfileroot’s shell settings.
- .bash_historyfileThe commands run as root in earlier sessions.
- .sshdirectoryKeys allowed to log in as root, and root’s own keys.
- .profilefileCommands run at login.
At the terminal
Four commands that show what this directory is doing on a real machine.
ls /rootAs an ordinary user this fails with “Permission denied” — which is the point.
sudo ls -la /rootList root’s home with root’s rights.
sudo -iStart a shell as root. It opens in /root.
ls -ld /rootShow the permissions on the directory itself: owner only.
Handle with care
What goes wrong here, and what someone securing or attacking the machine looks at.
A mistake made as root has no safety net. Use your own account and sudo for the single command that needs it.
/root/.ssh/authorized_keys lists the keys that can log in as root directly. An entry there that nobody recognises is serious.