CNT4603 - 2016 Summer
Journals Due Wednesday, October 19 by midnight on Blackboard.
You have received a new batch of distinguished users; their basic information
is located in newusers.tar. Inside of the tar file, there is a file
called "newusers.txt" which contains a colon-separated entry for each user: the
username, the uid, the GECOS information, and the user's preferred shell. Also in
the tar file you will find a public key for each of these users in the subdirectory
Please write a Bash script to add these users to your Debian machine as
local users (you might to verify that no name clashes occur, though,
before you proceed!)
The Bash script should expect two arguments, the name of the users file
file (newusers.txt, in this case) and the directory where their public
keys are stored (pubkeys/, in this case.)
The script should, for each new user, create a home directory on your Debian box with the usual
files from /etc/skel, but
put the home directories in /home/users/USERNAME/, not just /home/USERNAME.
Please use the user id from the file to create the home
directories. Each user should also have his own group, where the group
id matches the user id. Don't assign passwords to these accounts;
instead, set it up so that the users can login using the public key
provided in the tar file.
Please add a test user to the newusers.txt with
a public key for whom you also have the corresponding private key and verify
that you can ssh into this test user's account, and that all permissions and directories are
set up correctly for that user from within that okay.
Create a /scratch/USERNAME/ directory for each user, and make sure that it is owned by the correct
user and has the correct group number.
As a suggestion, your internal loop could look something like
although of course there are many ways to do this, such as using Bash's
mapfile to create an array to iterate over.
while IFS=: read name uid gecos homedir
[ .... ]
done < $userfile
A journal is due for this assignment. Make sure that you document in
your journal all of the steps that you went through. In particular, please
make sure that your script is included.
Please turn in a printed copy of this assignment
by 11:59pm on Wednesday, October 19, on Blackboard.