Chapter 7. Enabling Multiple Users
7.1. Analysis
Up to now the system has been operating in single−user mode. There is no login process and anyone who
boots the system goes straight into a shell with root privileges. Obviously, this is not the normal operating
mode for most GNU/Linux distributions. Most systems feature multi−user capability where many users can
access the system simultaneously with different privilege levels. These multi−user systems also support
virtual consoles so that the keyboard and video display can be multiplexed between several terminal sessions.
So in this phase we would like to add the following enhancements to the system:
Enable multi−user capability.
•
Create multiple, virtual consoles.
•
7.2. Design
7.2.1. The login process
The From−Powerup−To−BASH−Prompt−HOWTO does a good job of outlining the steps in the login
process. Basically it works like this.
The init daemon starts a getty process on the terminal.
1.
The getty program displays the contents of
/etc/issue
and prompts for a user name.
2.
When the user name is entered, control is handed off to the login program.
3.
The login program asks for a password and verifies the credentials using
/etc/passwd
,
/etc/group
and possibly
/etc/shadow
.
4.
If everything is okay the user's shell is started.
5.
7.2.2. Obtaining source code
The getty and login programs were already installed as part of the util−linux package so there is no need to
download any new source code.
7.2.3. Creating support files
7.2.3.1. Device nodes
Details about virtual console device files can be found in the Linux kernel source code file called
devices.txt
in the
Documentation
directory. We will need to create
tty1
through
tty6
for each of
the virtual consoles as well as
tty0
and
tty
to represent the current virtual console.
7.2.3.2. /etc/issue
The
/etc/issue
file is pretty easy to construct. It can contain any text we want displayed on the screen
prior to the login prompt. It could be something friendly like "Welcome to Pocket Linux", something
menacing like "Authorized users only!" or something informational like "Connected to tty1 at 9600bps". The
agetty(8) manpage explains how to display information like tty line and baud rate using escape codes.
Chapter 7. Enabling Multiple Users
35