Lab 12 ITN 103

Step 1  Introduction to Users

 

The whoami command?

The who command ?

With who am i command?

The w command?

The id command ?

 

Step 2 Using other users to process commands

The su command ?

Can su be used to become root?

When no username is provided to su or su - command what happens?

What is sudo command?

 

Step 3 User Management

What is  /etc/passwd ?

Step 4  Creating a user

You can add users with the useradd command. The example below shows how to add a user named yanina (last parameter) and at the same time forcing the creation of the home directory (-m), setting the name of the home directory (-d), and setting a description (-c).


# useradd -m -d /home/jim -c "jim richerson" jim
# tail -1 /etc/passwd
jim:x:529:529:jim richerson:/home/jim:/bin/bash

You can delete the user jim with userdel. The -r option of userdel will also remove the home directory.
# userdel -r jim

Step 5  Modify a User

 

You can modify the properties of a user with the usermod command. This example uses usermod to change the description of the user harry.

# tail -1 /etc/passwd
harry:x:516:520:harry potter:/home/harry:/bin/bash
# usermod -c 'wizard' harry
]# tail -1 /etc/passwd
harry:x:516:520:wizard:/home/harry:/bin/bash

 

Step 6  Practice User Mangement

Create a user accounts, including a home directory and a description (or comment) that reads "xxx". Do all this in one single command.

Create another user, including home directory, bash shell, a description that reads "xxx" all in one single command.

Verify that both users have correct entries in /etc/passwd, /etc/shadow and /etc/group and make sure you show me.

Verify that their home directory was created in lab.

Show me the commands you used to create these.

 

Download this Lab and answer the questions and comments on the steps and upload to Canvas under the module for this lab.