Configuring user accounts

As I have hinted already, it is not good practice to run all programs as root since, if one is compromised by an outside attack, then the whole system is at risk and a misbehaving program can do more damage if it is running as root. It is preferable to create unprivileged user accounts and use them where full root is not necessary.

User names are configured in /etc/passwd. There is one line per user, with seven fields of information separated by colons:

  • The login name
  • A hash code used to verify the password , or more usually an x to indicate that the password is stored in /etc/shadow
  • UID
  • GID
  • A comment field, often left blank
  • The user's home directory
  • (Optional) the shell this user will use

For example, this creates users root ...

Get Embedded Linux for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.