Root or Superuser Powers
This contains links to information used in the lectures.
Unix model of ownership
Superuser
UID 0 is treated differently than any other. It is said to have
superuser privileges. Conventionally UID 0 is called root.
The superuser can access any local file or process. Certain system calls
can only be executed by root for example:
- Mounting and unmounting filesystems
- Changing the root directory of a process
- Creating device files
- Setting system clock
- Changing ownership of files (BSD) - this can effect quotas
- Raising resource limits and setting priorities
- Setting hostname
- Configuring network interfaces
- Shutting down
root programs can change ownership at will. login is a
good example.
Root password choice
Since it is important that the root password be secure, it should not
be an easily guessed word. Various systems enforce rules on password,
such as that the password be mixed case or contain at least one special
character. Root passwords should be the full eight characters - longer is
useless, since only eight are checked.
There
are also
recommendations.
One should change the password regularly, when anyone with superuser
privileges leaves, and if security has been compromised.
Becoming Root
- login
The superuser has a login root.
- su
This prompts for root password and starts a root shell. Note
that it does not run roots login script or change to the root
home directory.
Be careful that one is actually executing /bin/su not some
user script.
It can also be used to become other users, by su username.
If the first argument to su
is a -, the environment is changed to what would be expected if the
user actually logged in as the specified user.
- sudo
Problems with root:
- Power is omnipotent
- No record of operations
- May be group login - cannot tell who did what
sudo is a program to allow limited root logins, for example to
do backups. sudo uses a file /etc/sudoers to list
people who can sudo and the commands they can run.
There is a special visudo to edit this file.
Sudo
- allows multiple commands but timesout after 5 mins inactivity.
- keeps log of commands executed
Syntax is sudo command arguments.
Advantages:
- More accountability
- Limited root privileges
- Smaller group knows root password
- sudo is faster than su
- Privileges can be granted and revoked easily
- A list is maintained
- Different privileges can be given on different machines on the net
Of course security is not absolute, for example sudo csh or
sudo su would circumvent it, if allowed.
Other system users - daemon, bin, sys, nobody
Paul A. Farrell
Wednesday, January 17, 1996