Question
Linux: PART A Exercise 1 The following is a session: $ id a uid=318(hawkeye) gid=300(users) groups=100(staff), 300(users) $ ls -ld . file* /etc/passwd /etc/shadow /etc
Linux:
PART A
Exercise 1
The following is a session: $ id a uid=318(hawkeye) gid=300(users) groups=100(staff), 300(users) $ ls -ld . file* /etc/passwd /etc/shadow /etc drwxr-xr-x 2 trapper users 512 Jul 11 11:21 . -rw-rw-r-- 1 trapper staff 23 Jul 15 10:21 file1 -rw-r----- 1 trapper mash 41 Jul 15 10:21 file2 -rw-rw-rw- 1 hawkeye mash 41 Jul 15 10:21 file3 -r--r--r-- 1 root sys 132 Jan 01 9:30 /etc/passwd -r-------- 1 root sys 96 Jan 01 9:30 /etc/shadow drwxrwxr x 49 root sys 4096 Jan 01 9:30 /etc Which of the following operations are permitted? Circle it $ more file1 $ more file2 $ ls -l >file1 $ more /etc/passwd $ more /etc/shadow $ rm file2 $ rm file3 $ cp file1 file4 $ rm /etc/passwd $ rm /etc/shadow Exercise 2 - Working with the quota Utilities 1. Modify the following line in /etc/fstab to allow for user and group quotas: /dev/hda1 /home ext2 defaults 1 2 2. Examine the following example output from edquota -u tempuser: Quotas for user tempuser: /dev/hda2: blocks in use: 6502, limits (soft = 8000, hard = 10000) inodes in use: 814, limits (soft = 2000, hard = 2500) Write the command to duplicate this quota for every user in the tools group.
Exercise 3 - Adding and Modifying Users
Write down the commands used to perform the following.
1. Add a user called frank. 2. Add a user called radar specifying the Korn shell. 3. Add a user called klinger using /home2/klinger as the home directory. 4. Add a user called mulcahy specifying a UID of 400 and a group of staff. 5. Modify the user frank to use the korn shell. 6. Modify radar to give him a new UID of 401.
Exercise 4 - Managing Users
1. Use useradd to add a new user called hawkeye (full name Pierce) with a user ID of 318. Dont forget to use the -m option to create the users home directory. Set a password for this account and force this password to expire the next time the user logs in. Test your new account first by using su and then by logging out and back in again as the new user hawkeye.
2. Correct the full name for user hawkeye to be B F Pierce and give him /bin/bash as his login shell.
3. As root, use chage l to show the status of hawkeyes password protection. Change the password aging to: Maximum number of days: 7 Minimum number of days: 2 Warning number: 7 Log in as hawkeye and try to change the password. If you cannot, su to root and fix the problem. Exit from the root shell and change the password for hawkeye.
4. Create a new group called swamp. Modify hawkeye to be a member of group swamp; do not modify hawkeyes default group. In one command, add a new user trapper with full name J F X McIntyre, user ID 319, and membership in the supplementary group swamp (leave the users default group as its default value). Set a password for trapper and log out. Verify that you can log in as trapper correctly and, as trapper, enter the following commands:
$ batch date ^D This will ensure that there is a mail message for trapper. Do not read this mail message yet; we want it to remain in the mailbox.
5. Remove the account for trapper, including the home directory. Now find out if trapper still owns any files on the system. Use useradd to re-create the trapper account with the same parameters as before. You will not be able to do this because the system will not let you reuse the 319 user ID for another 20 days. What command option should you have specified to ensure that you could reuse the 319 user ID?
6. List all of the groups that root is a member of (dont forget the default group).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started