0% found this document useful (0 votes)
36 views

CH 07 Lab-Answers

The document describes steps to manage user accounts and groups on a Linux system. It involves creating multiple user accounts and setting passwords, adding users to groups, modifying user and group details, and verifying the changes. Tasks include adding and removing users, changing passwords and group membership, and deleting a group.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

CH 07 Lab-Answers

The document describes steps to manage user accounts and groups on a Linux system. It involves creating multiple user accounts and setting passwords, adding users to groups, modifying user and group details, and verifying the changes. Tasks include adding and removing users, changing passwords and group membership, and deleting a group.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Ch7 Lab

1. Log as root
2. Add a new user named alexa and set her password

[root@server3 ~]# useradd alexa ; passwd alexa

Changing password for user alexa.

New password:

Retype new password:

passwd: all authentication tokens updated successfully.

3. Add a new user named maria including her full name Maria Smith and set her password

[root@server3 ~]# useradd -c "Maria Smith" maria ;passwd maria

4. Add a new user named bob and set his password

[root@server3 ~]# useradd bob ; passwd bob

5. Add a new user named andrew and set his password

[root@server3 ~]# useradd andrew ; passwd andrew

6. Add a new user named mario and set his password

[root@server3 ~]# useradd mario ; passwd mario

7. Verify the list of users

[root@server3 ~]# tail -6 /etc/passwd

alex:x:500:500::/home/alex:/bin/bash

alexa:x:501:501::/home/alexa:/bin/bash

maria:x:502:502:Maria Smith:/home/maria:/bin/bash

bob:x:503:503::/home/bob:/bin/bash

andrew:x:504:504::/home/andrew:/bin/bash

mario:x:505:505::/home/mario:/bin/bash

8. Create two groups: marketing and accounting


[root@server3 ~]# groupadd marketing

[root@server3 ~]# groupadd accounting

9. Add the users alexa , maria and bob to the marketing group

[root@server3 ~]# gpasswd -a alexa marketing

[root@server3 ~]# gpasswd -a maria marketing

[root@server3 ~]# gpasswd -a bob marketing

10. Add the users andrew , mario and bob to the accounting group.

[root@server3 ~]# gpasswd --members andrew,mario,bob accounting

11. Verify the list of groups

[root@server3 ~]# tail -3 /etc/group

mario:x:505:

marketing:x:506:alexa,maria,bob

accounting:x:507:bob,andrew,mario

[root@server3 ~]#

12. Delete the user account of alexa and verify that her home directory has not been removed

[root@server3 ~]# userdel alexa

[root@server3 ~]# ls /home/

alexa andrew bob maria mario alex

13. Delete the user account and the home directory of mario and verify that both the account
and the home directory of mario have been deleted

[root@server3 ~]# userdel -r mario

[root@server3 ~]# ls /home/

alexa andrew bob maria alex


14. Change the full name of maria to Maria Clark and verify the change

[root@server3 ~]# usermod -c "Maria Clark" maria

[root@server3 ~]# grep maria /etc/passwd

maria:x:502:502:Maria Clark:/home/maria:/bin/bash

[root@server3 ~]#

15. Verify who are the users members of the groups marketing and accounting

[root@server3 ~]# grep marketing /etc/group

marketing:x:506:maria,bob

[root@server3 ~]# grep accounting /etc/group

accounting:x:507:bob,andrew

[root@server3 ~]#

16. Delete the group marketing and verify the delete

[root@server3 ~]# groupdel marketing

[root@server3 ~]# tail -5 /etc/group

alex:x:500:

maria:x:502:

bob:x:503:

andrew:x:504:

accounting:x:507:bob,andrew

[root@server3 ~]#

17. Change the name of the group accounting to account_group and verify the change

[root@server3 ~]# groupmod -n account_group accounting

[root@server3 ~]# tail -5 /etc/group

alex:x:500:
maria:x:502:

bob:x:503:

andrew:x:504:

account_group:x:507:bob,andrew

[root@server3 ~]#

18. Verify to which group the user bob belongs

[root@server3 ~]# groups bob

bob : bob account_group

[root@server3 ~]#

19. Remove the user bob from the group account_group

[root@server3 ~]# gpasswd -d bob account_group

[root@server3 ~]# groups bob

bob : bob

[root@server3 ~]#

20. Change the password of the users maria and bob

[root@server3 ~]# passwd maria

Changing password for user maria.

New password:

Retype new password:

passwd: all authentication tokens updated successfully.

[root@server3 ~]# passwd bob

Changing password for user bob.

New password:
Retype new password:

passwd: all authentication tokens updated successfully.

[root@server3 ~]#

21. Log as maria or bob

[root@server3 ~]# su - bob


22. Change your password

[bob@server3 ~]$ passwd


Changing password for user bob.
Changing password for bob.
(current) UNIX password:
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[bob@server3 ~]$

23. Exit then login again as maria or bob to verify the password change

[alex@server3 ~]$ su - bob


Password:
su: incorrect password
[alex@server3 ~]$ su - bob
Password:
[bob@server3 ~]$

You might also like