Changes

Jump to: navigation, search

OPS235 Lab 4

174 bytes added, 14:07, 23 June 2016
no edit summary
There are many other tasks that a Linux system administrator must perform other than installing Linux and installing software.
User account management is a very important operation that a Linux sysadmin does on a consistent an continual basis. The sysadmin not only needs to add or remove user accounts by issuing commands, but may need to automate user account creations a large number (batch) of potential employees. There are many features with the Linux command to create new users including: specification of a home directory, type of shell used, name, password and time-limit (referred to as "aging") for a new user account. Removing user accounts also have options such as removing the user account but keeping the home directory for reference or evidence of "wrong-doing"
Many students may think that the following topic is small and "not a big deal". Those students may say, '''"How hard is running and stopping services?"'''
# Launch your '''c7host''' and '''centos1''' VMs.
# Switch to your '''centos1''' VM.
# Open a shell terminal and login as '''root'''.
# Look at the <b><code><span style="color:#3366CC;font-size:1.2em;">/etc/passwd</span></code></b> file.
# Remain in your '''centos1''' VM for this section.
# Read the man page for the <b><code><span style="color:#3366CC;font-size:1.2em;">useradd</span></code></b> command.
# Create a new user called '''ops235_1''' by issuing the command: <br><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><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: <br><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?
# Issue the following command to remove ops235_2's home directory: <b><code><span style="color:#3366CC;font-size:1.2em;">rm -rf /home/ops235_2</span></code></b>
# Issue the '''userdel''' comamnd to remove the '''ops235_1''' account with the '''-r option''' (and home directory regardless if it exists or not).
# Issue the useradd -m command to recreate the user 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.
# Look at Create a new file in the man page for '''/etc/shadowskel''' using the command: <b><code><span style="color:#3366CC;font-size:1.2em;">man 5 shadow</span></code></b># Create a new file in the /etc/skel directory with the following command: <b><code><span style="color:#3366CC;font-size:1.2em;">touch /etc/skel/foo</span></code></b>
# Recreate the new user (with home directories automatically created) for '''ops235_2'''.
# Set the password for the user '''ops235_2'''.
#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;">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?
:'''Perform the following steps:'''
#Make certain that you are still in your '''centos1''' VM.#Close your terminalall application windows, and switch user accounts (within your centos1 VM) by clicking on the top right-hand side of the screen (power icon), click '''your regular username''', click '''switch user''', and login as '''"New Name" ''' (i.e. ops235_2).
#Open a shell terminal.
#Create a file called '''information.txt''' in home directory of that user.

Navigation menu