Changes

Jump to: navigation, search

OPS235 Lab 4

25 bytes added, 23:29, 21 June 2016
no edit summary
In this section, we will now learn how to <u>properly</u> add user accounts, remove user accounts, and modify existing user account information.
:'''Perform the following steps:'''
# Remain in your '''centos1''' VM for this section.
# Create a new user called '''ops235_1''' by issuing the command: <b><code><span style="color:#3366CC;font-size:1.2em;">useradd ops235_1</span></code></b>
# Issue the command: <b><code><span style="color:#3366CC;font-size:1.2em;">grep ops235_1 /etc/passwd</span></code></b> to see if that user account was created.
# View the '''/home''' directory to view the contents. Is the user ops235_1's home directory there?<br>'''NOTE:''' In some versions of Linux, you may have to issue the -m option with the useradd command in order to create a home directory for that user.<br><br>
# Issue the following command to create the user called ops235_2: <b><code><span style="color:#3366CC;font-size:1.2em;">useradd -m ops235_2</span></code></b>
# View the '''/home''' directory to verify that the home directory for '''ops235_2''' has been created. What does the -m option do for the useradd command?
# Issue the following command to remove the user called ops235_2: <b><code><span style="color:#3366CC;font-size:1.2em;">userdel ops235_2</span></code></b>
# Issue the grep command with the /etc/passwd file to verify that the username ops235_2 was removed.
# View the contents of the '''/home''' directory. Was the home directory for user '''ops235_2''' removed? As root, remove that directory. What option do you need to use with the userdel command to automatically remove the user's home directory?# Issue the '''userdel ''' comamnd to remove the '''ops235_1''' account with the '''-r option''' (and home directory regardless if it exists or not).# Recreate Issue the useradd -m command to recreate the new user (with home directories automatically created) for called: '''ops235_1'''.
# Use the '''passwd''' command to set the password for the user '''ops235_1'''.
# View the <u>contents</u> for '''ops235_1's''' home directory and note the files.
# Recreate the new user (with home directories automatically created) for '''ops235_2'''.
# Set the password for the user '''ops235_2'''.
# View the <u>contents</u> for '''ops235_2's home directory ''' and note the files. What do you notice that is different. What do you think is the purpose of the '''/etc/skel''' directory?
# Be sure to record your observations in your lab notes.
#Issue the man pages for the '''useradd''' command. Explain the purpose of using the '''-e''' option for the ''useradd'' command.
#Issue the following command: <b><code><span style="color:#3366CC;font-size:1.2em;">chage -E 2018-05-31 ops235_1</span></code></b>
#Issue the following command: <b><code><span style="color:#3366CC;font-size:1.2em;">chmod usermod -c "New Name" ops235_2</span></code></b>. View ops235_2's account information in the '''/etc/passwd''' file. What do you notice is different?
# Issue the following command to obtain information regarding the user called ops235_1: <b><code><span style="color:#3366CC;font-size:1.2em;">chage -l ops235_1</span></code></b>. What do you think is the purpose of the chage command and the useradd command with the -e option?
 
{| width="40%" align="right" cellpadding="10"
13,420
edits

Navigation menu