CHAPTER 7 · 5 lessons · 65 exercises

Users and groups

Who you are logged in as. And what it actually means to become the administrator.

The last chapter kept saying "the owner". This chapter is about the users who are those owners.

Linux was built from the start on the idea that several people use it at once. So whatever you do, the question "who are you?" comes first. Start by settling that with whoami and id.

Then there is root, the special user who can do anything, slipping past every permission check. In this course you switch to root with su to make users and hand things over to new owners.

  • whoami id groups — find out who you are
  • su — switch to root (the password in this course is fulfledge)
  • adduser passwd — make a user
  • addgroup — make a group and put people in it
  • /etc/passwd /etc/shadow — read the files that say who is here

Two important things. Keep your time as root as short as you can, because nothing is left to stop you when you get something wrong. And never write a password into your notes on a real computer. It is written here only because this is a throwaway Linux with no connection to the outside network.

Out in the world people mostly use a tool called sudo. It is not in this environment, so you do the same things with su. The thinking is the same.

Lessons in this chapter

Who am I

  1. 34Become root (`su`)The special user who slips past every permission check. Switch with su, come back with exit.Go to the exercises
  2. 35Read the registersWho exists is written in /etc/passwd. Point the tools you know at the register and run an inspection.Go to the exercises

Create users and groups

  1. 36Make a userAdd a person with adduser. Give them a password, become them, then remove them.Go to the exercises
  2. 37Make a group and put people in itThe box that lets two people touch the same file. Including the difference between a main group and an added one.Go to the exercises
  3. 38Share a shelf with a groupPut the nine characters of chapter 6 together with the groups of chapter 7 and build a shelf two people can write to. Including setgid and umask.Go to the exercises

Next up is “Processes and signals”. See what is running right now. Stop something that will not stop. Run things in the background.