# Creating the passwd, group, and log Files

In order for user `root` to be able to login and for the name root to be recognized, there must be relevant entries in the `/etc/passwd` and `/etc/group` files.

Create the `${CLFS}/etc/passwd` file by running the following command:

    cat > ${CLFS}/etc/passwd << "EOF"
    root::&uid-root;:&gid-root;:root:/root:/bin/bash
    EOF

The actual password for `root` (the :: used here is just a placeholder and allows you to login with no password) will be set later.

## Additional users you may want to add:

`bin:x:&uid-bin;:&gid-bin;:bin:/bin:/bin/false`

- Can be useful for compatibility with legacy applications.

`daemon:x:&uid-daemon;:&gid-daemon;:daemon:/sbin:/bin/false`

- It is often recommended to use an unprivileged User ID/Group ID for daemons to run as, in order to limit their access to the system.

`adm:x:&uid-adm;:&gid-adm;:adm:/var/adm:/bin/false`

- Was used for programs that performed administrative tasks.

`lp:x:&uid-lp;:&gid-lp;:lp:/var/spool/lp:/bin/false`

- Used by programs for printing

`mail:x:&uid-mail;:&gid-mail;:mail:/var/mail:/bin/false`

- Often used by email programs

`news:x:&uid-news;:&gid-news;:news:/var/spool/news:/bin/false`

- Often used for network news servers

`operator:x:&uid-operator;:&gid-root;:operator:/root:/bin/bash`

- Often used to allow system operators to access the system

`postmaster:x:&uid-postmaster;:&gid-mail;:postmaster:/var/spool/mail:/bin/false`

- Generally used as an account that receives all the information of troubles with the mail server

`nobody:x:&uid-nobody;:&gid-nobody;:nobody:/:/bin/false`

- Used by NFS

Create the `${CLFS}/etc/group` file by running the following command:

    cat > ${CLFS}/etc/group << "EOF"
    root:x:0:
    bin:x:&gid-bin;:
    sys:x:&gid-sys;:
    kmem:x:&gid-kmem;:
    tty:x:&gid-tty;:
    tape:x:&gid-tape;:
    daemon:x:&gid-daemon;:
    floppy:x:&gid-floppy;:
    disk:x:&gid-disk;:
    lp:x:&gid-lp;:
    dialout:x:&gid-dialout;:
    audio:x:&gid-audio;:
    video:x:&gid-video;:
    utmp:x:&gid-utmp;:
    usb:x:&gid-usb;:
    cdrom:x:&gid-cdrom;:
    EOF

## Additional groups you may want to add

`adm:x:&gid-adm;:root,adm,daemon`

- All users in this group are allowed to do administrative tasks

`console:x:&gid-console;:`

- This group has direct access to the console

`cdrw:x:&gid-cdrw;:`

- This group is allowed to use the CDRW drive

`mail:x:&gid-mail;:mail`

- Used by MTAs (Mail Transport Agents)

`news:x:&gid-news;:news`

- Used by Network News Servers

`users:x:&gid-users;:`

- The default GID used by shadow for new users

`nogroup:x:&gid-nogroup;:`

- This is a default group used by some programs that do not require a group

`nobody:x:&gid-nobody;:`

- This is used by NFS

The created groups are not part of any standard—they are groups decided on in part by the requirements of the Udev configuration in the final system, and in part by common convention employed by a number of existing Linux distributions. The Linux Standard Base (LSB, available at ) recommends only that, besides the group root with a Group ID (GID) of 0, a group bin with a GID of 1 be present. All other group names and GIDs can be chosen freely by the system administrator since well-written programs do not depend on GID numbers, but rather use the group's name.

The `login`, `agetty`, and `init` programs (and others) use a number of log files to record information such as who was logged into the system and when. However, these programs will not write to the log files if they do not already exist. Initialize the log files and give them proper permissions:

    touch ${CLFS}/var/run/utmp ${CLFS}/var/log/{btmp,lastlog,wtmp}
    chmod -v 664 ${CLFS}/var/run/utmp ${CLFS}/var/log/lastlog
    chmod -v 600 ${CLFS}/var/log/btmp

The `/var/run/utmp` file records the users that are currently logged in. The `/var/log/wtmp` file records all logins and logouts. The `/var/log/lastlog` file records when each user last logged in. The `/var/log/btmp` file records the bad login attempts.