Becoming a Superuser Communicating with Other Users

Chapter 3: UNIX Administration Starters

3.1 Superuser and Users

The central entity in UNIX is a file — every activity on the system represents some kind of transaction with or between files. Consequently, administrators of UNIX systems are expected to deal with files, including the special purpose files known as configuration files. Configuring system functions, setting some system parameters, tuning a kernel, and restoring a lost file, all require the appropriate access to the needed data within the file. On the other side, system files always require privileged access. In practice, this means that the administrator has to be a superuser on the system in order to effectively administer the UNIX system.

3.1.1 Becoming a Superuser

On a UNIX platform, the superuser is a privileged user with unrestricted access to all files and commands. The name of this user account is root; the account is protected with a password as with any other user account. There are two ways to become the superuser: Log in directly as root. This is always possible from the system console; it is recommended that you disable the direct root log−in from other terminals as a security precaution, but this is not a requirement. 1. Switch from another user log−in account to the superusers account by executing the su command. 2. In both cases the system will prompt for the root password. After entering the correct password, the superuser is logged into the system and has full control over all its resources. The root account is extremely sensitive; one wrong move can easily destroy important files and crash the system itself. Only knowledgeable persons should enjoy superuser status; it is very important to restrict root access only to a certain group of people who are responsible for the system itself. Obviously UNIX administrators should belong to this group.

3.1.2 Communicating with Other Users

The UNIX administrator frequently needs to communicate with other users, mostly to inform them of current administrative activities being performed on the system. Some examples include instructing all logged−in users to close their files and logout on time when a system is going to be shut down informing users when new software is installed, or passing along any other information important for regular system operations. Several UNIX commands are available for this purpose: Sending a message to the user: write username [tty] • where username User to whom the message is sent [tty] Optional terminal if the user is logged in to more than one 65 Sending a message to all users wall stands for write all ♦ The text of the message should be typed after the command was issued; typing Ctrl−D D terminates the command. The typed text of the message will be displayed at the terminals of all logged−in users. • Sending the message of the day The message of the day —motd — can be used to broadcast systemwide information to all users. The file etcmotd keeps an arbitrary message which will be displayed during any users log−in procedure. Log−in is probably the most convenient time to catch the users attention, because the user is fully concentrated on the output of the log−in procedure. That makes it an ideal time to inform users about changes in the system, newly installed software, and so on. Any editor can be used to edit the etcmotd file; the default UNIX editor is vi. • Sending e−mail to users E−mail is a convenient vehicle for communicating nonurgent or lengthy messages to users. E−mail is especially convenient for informing users about automated jobs because it is very easy, for example, to send a message about the status of an executed job to the users from the script that ordered the execution. •

3.1.3 The su Command