Está en la página 1de 6

Práctica 5:

Gestión de grupos, usuarios, permisos y propietarios

El grupo shakespeare está formado por los usuarios juliet, romeo y hamlet. El grupo artists está formado por los usuarios reba,
dolly y elvis.

GROUP GID
shakespeare 30000
artists 40000

USER FULLNAME UID DIRECTORY SHELL GROUPS


julieth Julieht P 30101 /home/julieth /bin/bash shakespeare
romeo Romeo S 30102 /srv/romeo /sbin/nologin shakespeare
hamlet Hamlet Principe 30103 /home/hamlet /bin/bash shakespeare,artists
reba Rebadis 40301 /home/reba /bin/bash artists
dolly Dolly Sheep 40302 /srv/dolly /sbin/nologin artists,shakespeare
elvis Elvis P 40303 /srv/dolly /sbin/nologin artists,shakespeare

1. Autentiquese como usuario root en su shell prompt:


sysadmin@localhost: ~$ su -
Password: netlab123

2. Cree un grupo suplementario con el nombre shakespeare y con el ID de grupo 30000.


root@localhost:~# groupadd -g 30000 shakespeare

3. Cree un grupo suplementario con el nombre artists y con ID de grupo 40000.


root@localhost:~# groupadd -g 40000 artists

4. Confirme que shakespeare y artists hayan sido agregados examinando el archivo /etc/group.
root@localhost:~# tail -5 /etc/group

5. Cree el usuario julieth con ID de usuario 30101 nombre completo Julieth P con directorio de inicio /home/julieth con
un shell que le permite ejecutar comandos /bin/bash
root@localhost:~# useradd -u 30101 -c "Julieth P" -d /home/julieth -s /bin/bash julieth

6. Confirme que el usuario julieth fue agregado examinando el archivo /etc/passwd.


root@localhost:~# tail -5 /etc/passwd

7. Asigne contraseña al usuario julieth, puede utilizar el mismo nombre como contraseña. Utilice el comando passwd para
inicializar la contraseña de juliet
root@localhost:~# passwd julieth
Enter new UNIX password: julieth
Retype new UNIX password: julieth
passwd: password updated
successfully

8. Para verificar si el usuario julieth tiene asignada contraseña examine el archivo /etc/shadow (la contraseña aparece
encriptada)
root@localhost:~# tail -5 /etc/shadow

9. Según la tabla de usuarios inicial, encontramos que el usuario julieth pertenece al grupo suplementario shakespeare, y
cuando se creó no fue agregada al grupo. Utilice el comando usermod para modificar el usuario julieth.
root@localhost:~# usermod -aG shakespeare juliet

10. Confirme que el usuario julieth fue adicionada al grupo shakespeare examinando el archivo /etc/passwd.
root@localhost:~# tail -5 /etc/group
11. Cree el usuario romeo según la tabla de usuarios inicial.
root@localhost:~# useradd -u 30102 -c "Romeo S" -d /srv/romeo -s /sbin/nologin -G shakespeare romeo

12. Confirme que el usuario romeo fue agregado examinando el archivo /etc/passwd. Y confirme si fue agregado al grupo
shakespeare.
root@localhost:~# tail -10 /etc/passwd

root@localhost:~# tail -10 /etc/group

13. Asigne contraseña al usuario romeo,


root@localhost:~# passwd romeo
Enter new UNIX password: romeo
Retype new UNIX password: romeo

14. Repita los mismos pasos anteriores para crear los usuarios faltantes de la tabla inicial de usuarios.
root@localhost:~# useradd -u 30103 -c "Hamlet Principe" -d /home/hamlet -s /bin/bash -G shakespeare,artists hamlet
root@localhost:~# useradd -u 40101 -c "Rebadis" -d /home/reba -s /bin/bash -G artists reba
root@localhost:~# useradd -u 40102 -c "Dolly Sheep" -d /srv/dolly -s /sbin/nologin -G artists,shakespeare dolly
root@localhost:~# useradd -u 40103 -c "Elvis P" -d /srv/elvis -s /sbin/nologin -G artists,shakespeare elvis

15. Verifique que los usuarios hayan sido agregados al revisar el archivo /etc/passwd según las condiciones indicadas en
la tabla
root@localhost:~# tail -10 /etc/passwd

16. Verifique las membresías de los grupos suplementarios artists y shakespeare y que tengan los usuarios según la
tabla de usuarios inicial.

root@localhost:~# tail -10 /etc/group

17. Asigne contraseña al usuarios creados hamlet, reba, dolly y elvis. Utilice como contraseña su mismo usuario.
root@localhost:~# passwd hamlet
root@localhost:~# passwd reba
root@localhost:~# passwd dolly
root@localhost:~# passwd elvis

18. Verificar que todos los usuarios creados tengan asignada contraseña examinando el archivo /etc/shadow.
root@localhost:~# tail -10 /etc/shadow

19. Cree (9) archivos llamados usuarios1.txt hasta usuarios9.txt en el directorio /opt
root@localhost:~# touch /opt/usuarios{1..9}.txt
root@localhost:~# ls -l /opt
20. Cree los directorios poets y poems en /opt
root@localhost:~# mkdir /opt/poe{t,m}s
root@localhost:~# ls -l /opt

21. Cambie los permisos a cada archivo y directorio creado anterior así como se muestra a continuación:
drwx------. 2 julieth artists 4096 Mar 25 01:36 poems
drw-r-----. 2 elvis shakespeare 4096 Mar 25 01:36 poets
-rwxr-xr-x. 1 romeo shakespeare 0 Mar 25 01:36 usuarios1.txt
-rw-------. 1 romeo shakespeare 0 Mar 25 01:36 usuarios2.txt
-rwxr-xr-x. 1 hamlet artists 0 Mar 25 01:36 usuarios3.txt
-rw-------. 1 hamlet artists 0 Mar 25 01:36 usuarios4.txt
-rwxr-xr-x. 1 hamlet artists 0 Mar 25 01:36 usuarios5.txt
-rw-rw----. 1 reba artists 0 Mar 25 01:36 usuarios6.txt
-rwxr-xr-x. 1 reba artists 0 Mar 25 01:36 usuarios7.txt
-rw-rw-rwx. 1 dolly shakespeare 0 Mar 25 01:36 usuarios8.txt
-rwxr-xr-x. 1 dolly shakespeare 0 Mar 25 01:36 usuarios9.txt

root@localhost:~# chmod 700 -R /opt/poems/


root@localhost:~# chmod 640 -R /opt/poets/
root@localhost:~# chmod 755 /opt/usuarios{1,3,5,7,9}.txt
root@localhost:~# chmod 600 /opt/usuarios{2,4}.txt
root@localhost:~# chmod 660 /opt/usuarios6.txt
root@localhost:~# chmod 667 /opt/usuarios8.txt
root@localhost:~# ls -l
22. Cambie el usuario propietario y el grupo propietario a cada archivo y directorio así como se muestra a continuación:
drwx --. 2
drw-r-----. 2 4096 Mar 25 01:36 poems
-rwxr-xr-x. 1
-rw-------. 1
-rwxr-xr-x. 1julieth artists
-rw-------. 1elvis shakespeare
-rwxr-xr-x. 1
-rw-rw----. 1romeo shakespeare
-rwxr-xr-x. 1
-rw-rw-rwx. 1romeo shakespeare
-rwxr-xr-x. 1hamlet artists
hamlet artists
hamlet artists
reba artists
reba artists
dolly shakespeare
dolly shakespeare
4096 Mar 25 01:36 poets
0 Mar 25 01:36 usuarios1.txt
0 Mar 25 01:36 usuarios2.txt
0 Mar 25 01:36 usuarios3.txt
0 Mar 25 01:36 usuarios4.txt
0 Mar 25 01:36 usuarios5.txt
0 Mar 25 01:36 usuarios6.txt
0 Mar 25 01:36 usuarios7.txt
0 Mar 25 01:36 usuarios8.txt
0 Mar 25 01:36 usuarios9.txt

root@localhost:~# chown julieth:artists -R /opt/poems/


root@localhost:~# chown elvis:shakespeare -R /opt/poets/
root@localhost:~# chown romeo:shakespeare /opt/usuarios{1,2}.txt
root@localhost:~# chown hamlet:artists /opt/usuarios{3,4,5}.txt
root@localhost:~# chown reba:artists /opt/usuarios{6,7}.txt
root@localhost:~# chown dolly:shakespeare /opt/usuarios{8,9}.txt
root@localhost:~# ls -l

También podría gustarte