Managing User Accounts

Instructions

Q&A (0)

Notes (0)

Resources (0)

Saving Progress...

Resources

There are no resources for this lesson.

Notes can be saved and accessed anywhere in the course. They also double as bookmarks so you can quickly review important lesson material.

Create note

In this lesson, we will follow the lifecycle of a user account on a Linux/Unix system from creation, through modification, to deletion. We will also cover how to manage user groups.

Creating a User Account

useradd (Create New User Account) Let's start by creating a new user account named john:

sudo useradd -m -s /bin/bash john

Here is a breakdown of what that command does:

We can run list the contents of /home and should see the users new home directory:

ll /home/
# drwxr-x---  2 john     john     4096 Oct  3 01:08 john/

Additionally, we can switch to the john user by running the following command:

sudo su john

This will show us that we have switch to the john user:

john@ip-10-0-7-42:/home/iacadmin$

We can exit that user by typing 'exit':

exit

This will show that you have switched back to your other user account (in our labs it is iacadmin):

iacadmin@ip-10-0-7-42:~$ 

Modifying the User Account

usermod (Modify Existing User Account) Now, let’s change John’s username to john_doe and update his home directory:

sudo usermod -l john_doe john  # Changes the username
sudo usermod -d /new/home/dir john_doe  # Changes the home directory

Deleting the User Account

deluser (Delete User Account) Finally, let’s delete the john_doe user account:

sudo deluser --remove-home john_doe

We covered:

See you in the next lesson!

Server Academy Members Only

Want to access this lesson? Just sign up for a free Server Academy account and you'll be on your way. Already have an account? Click the Sign Up Free button to get started..

0 0 votes
Lesson Rating
Subscribe
Notify of
profile avatar
0 Comments
Inline Feedbacks
View all comments