Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

6. Write commands to accomplish the following (use the manual or info pages if n

ID: 3821526 • Letter: 6

Question

6. Write commands to accomplish the following (use the manual or info pages if necessary):

a. Create a user with a login name of bsmith, a UID of 733, a GECOS field entry of “accounting manager,” and a password of Gxj234

b. Delete the user jdoe, but leave the home directory intact

c. Change the properties of the existing user wjones such that the user has a new comment field of “shipping” and an account expiry of March 23, 2022

d. Lock the account of wjenkins

e. Change the password of bsmith to We34Rt

f. Change the properties of the existing user tbanks such that the user is a member of the managers group and has a login name of artbanks

g. Create a user with the same UID and primary group as root and a login name of wjones

h. Create a new user with a login name of jdoe who has a password of he789R and no home directory

i. Change the primary group of the user wsmith to root j

. Add the users tbanks and jdoe to the group acctg

Explanation / Answer

a)

useradd -u 733 -c "Accounting Manager" bsmith

usermod -p Gxj234 bsmith

You can use the -p in useradd command itself but that requires an encrypted form the password as returned by crypt(3). so you can do that as well. i had to use usermod -p as we can modify with unencrypted password in usermod while useradd -p we require encrypted password.

b)

userdel jdoe

this will keep the home directory intact

c)

usermod -c "shipping" -e 2022-03-23 wjones

d)

usermod -L wjenkins

e)

usermod -p We34Rt bsmith

f)

usermod -l artbanks -g managers tbanks

g)

since root has uid as 0 and gid as 0

useradd -u 0 -g 0 -md /home/wjones wjones

h)

adduser --no-create-home jdoe

usermod -p he789R jdoe

as explained in part a) for password modification.

i)

usermod -g root wsmith

j)

usermod -a -G acctg jdoe tbanks

i hope this is what you were looking for