- Create a new group 'dev'
groupadd dev
- Create a new user 'alice'. Make sure she is a member of the 'dev' group. Also, set
her description to "Alice from Dev", and her default shell to '/bin/csh'
useradd -g dev -c 'Alice from Dev' -s /bin/csh alice
- Check the log files and look for the log entries generated by adding alice to the
system
fgrep useradd /var/log/secure
- Create a new group 'mktg'
groupadd mktg
- Create a new user 'bob' as a member of group 'mktg' and secondary member of the 'dev'
group. Lock his account after you create it.
useradd -g mktg -G dev bob; passwd -l bob
- Modify user 'bob' and make his primary group 'dev' and his secondary group 'mktg'.
usermod -g dev -G mktg bob
- Unlock user 'bob'
passwd -u bob
- Set the minimum password lifetime on 'bob' and 'alice' to 21 days, and the maximum
lifetime to 45 days
passwd -n 21 -x 45 bob; passwd -n 21 -x 45 alice
- From the '/' directory, create a tar file backup of the home directory
cd /; tar cf home.tar home
- Create a new directory, '/backups'
mkdir /backups
- Set the permissions on the '/backups' directory to read/write/execute for owner, and no
perms for everyone else
chmod 700 /backups
- Using the highest compression level, compress your backup with gzip and move it to the
'/backups' directory
gzip -9 /home.tar && mv /home.tar.gz /backups
- Startup a 'netstat 1' command in the background. Make sure to redirect it's output to
a file, so it isn't cluttering up your screen!
netstat 1 > output &
- Stop your job
kill -STOP %1
- View the results of the job so far, in it's output file. You should see lots of information
about all the network connections currently existing on your computer.
less output
- Check the size of the file. Wait 5 seconds, check it again. Make sure it isn't
growing.
ls -la output; sleep 5; ls -la output
- Start the job running again.
kill -CONT %1
- Check the size of the file. Wait 5 seconds, check it again. Make sure it *is*
growing.
ls -la output; sleep 5; ls -la output
- Go ahead and kill the job.
kill %1
- Going back to your home directory backup. cd into the '/tmp' folder. Extract your home
backup. Check that the extract worked by comparing the '/tmp/home' folder with the '/home'
folder.
cd /tmp; gzip -dc /backups/home.tar.gz | tar xf - ; ls home /home; diff -r /home /tmp/home
- Figure out a way to count the total number of RPM packages installed on your machine.
rpm -qa | wc -l
- Generate an alphabetized list of the installed RPM packages on your machine.
rpm -qa | sort
- To what package does the '/usr/bin/time' command belong?
rpm -qf /usr/bin/time
[ answer is time-1.7-25 ]