Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Script started on Fri 21 Sep 2018 09:21:48 PM UTC
- [vagrant@localhost ~]$ userah dd -h -help
- bash: /usr/sbin/useradd: Permission denied
- [vagrant@localhost ~]$ su
- Password:
- [root@localhost vagrant]# useradd --help
- Usage: useradd [options] LOGIN
- useradd -D
- useradd -D [options]
- Options:
- -b, --base-dir BASE_DIR base directory for the home directory of the
- new account
- -c, --comment COMMENT GECOS field of the new account
- -d, --home-dir HOME_DIR home directory of the new account
- -D, --defaults print or change default useradd configuration
- -e, --expiredate EXPIRE_DATE expiration date of the new account
- -f, --inactive INACTIVE password inactivity period of the new account
- -g, --gid GROUP name or ID of the primary group of the new
- account
- -G, --groups GROUPS list of supplementary groups of the new
- account
- -h, --help display this help message and exit
- -k, --skel SKEL_DIR use this alternative skeleton directory
- -K, --key KEY=VALUE override /etc/login.defs defaults
- -l, --no-log-init do not add the user to the lastlog and
- faillog databases
- -m, --create-home create the user's home directory
- -M, --no-create-home do not create the user's home directory
- -N, --no-user-group do not create a group with the same name as
- the user
- -o, --non-unique allow to create users with duplicate
- (non-unique) UID
- -p, --password PASSWORD encrypted password of the new account
- -r, --system create a system account
- -R, --root CHROOT_DIR directory to chroot into
- -s, --shell SHELL login shell of the new account
- -u, --uid UID user ID of the new account
- -U, --user-group create a group with the same name as the user
- -Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
- [root@localhost vagrant]# vgrant a ad useradd -m amne ien ne
- [root@localhost vagrant]# useradd -m said
- [root@localhost vagrant]# useradd -m said karim
- [root@localhost vagrant]# cat /etc/shadow
- root:$1$VEt.WqKC$CamA1Xh1GBbWpR1YkSJR1/::0:99999:7:::
- bin:*:17632:0:99999:7:::
- daemon:*:17632:0:99999:7:::
- adm:*:17632:0:99999:7:::
- lp:*:17632:0:99999:7:::
- sync:*:17632:0:99999:7:::
- shutdown:*:17632:0:99999:7:::
- halt:*:17632:0:99999:7:::
- mail:*:17632:0:99999:7:::
- operator:*:17632:0:99999:7:::
- games:*:17632:0:99999:7:::
- ftp:*:17632:0:99999:7:::
- nobody:*:17632:0:99999:7:::
- systemd-network:!!:17663::::::
- dbus:!!:17663::::::
- polkitd:!!:17663::::::
- rpc:!!:17663:0:99999:7:::
- rpcuser:!!:17663::::::
- nfsnobody:!!:17663::::::
- sshd:!!:17663::::::
- postfix:!!:17663::::::
- chrony:!!:17663::::::
- vagrant:$1$xyskNOHy$fTX23HILCqtay.zv8cRaN.::0:99999:7:::
- vboxadd:!!:17795::::::
- amine:!!:17795:0:99999:7:::
- said:!!:17795:0:99999:7:::
- karim:!!:17795:0:99999:7:::
- [root@localhost vagrant]# #mo echo "mot de pass no No mot de pass"
- No mot de pass
- [root@localhost vagrant]# passwd amine
- Changing password for user amine.
- New password:
- BAD PASSWORD: The password is shorter than 8 characters
- Retype new password:
- passwd: all authentication tokens updated successfully.
- [root@localhost vagrant]# passwd said
- Changing password for user said.
- New password:
- BAD PASSWORD: The password is shorter than 8 characters
- Retype new password:
- passwd: all authentication tokens updated successfully.
- [root@localhost vagrant]# passwd karim
- Changing password for user karim.
- New password:
- BAD PASSWORD: The password is shorter than 8 characters
- Retype new password:
- passwd: all authentication tokens updated successfully.
- [root@localhost vagrant]# cat cat su karim
- [karim@localhost vagrant]$ groups
- karim
- [karim@localhost vagrant]$ exit
- [root@localhost vagrant]# groupadd etudiants
- [root@localhost vagrant]# usermod kai rim -G etuduants
- usermod: group 'etuduants' does not exist
- [root@localhost vagrant]# usermod karim -G etuduantsants iants
- [root@localhost vagrant]# usermod karim -G etudiants -G etudiants -G etudiants -G etudiants -G etudiants -G etudiants s -G etudiantsa -G etudiantsi -G etudiantsd -G etudiants
- [root@localhost vagrant]# usermod said -G etudiants -G etudiants -G etudiants -G etudiants -G etudiants a -G etudiantsm -G etudiantsi -G etudiantsn -G etudiantse -G etudiants
- [root@localhost vagrant]# su amine
- [amine@localhost vagrant]$ groups
- amine etudiants
- [amine@localhost vagrant]$ exit
- [root@localhost vagrant]# ls
- exo1.txt time.txt
- [root@localhost vagrant]# passwd -n 30 said
- Adjusting aging data for user said.
- passwd: Success
- [root@localhost vagrant]# passwd -l karim
- Locking password for user karim.
- passwd: Success
- [root@localhost vagrant]# usermod -L karim
- [root@localhost vagrant]# eh cho usermod -L karim" echo "hamid:x:1 cat /etc/a passwd
- root:x:0:0:root:/root:/bin/bash
- bin:x:1:1:bin:/bin:/sbin/nologin
- daemon:x:2:2:daemon:/sbin:/sbin/nologin
- adm:x:3:4:adm:/var/adm:/sbin/nologin
- lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
- sync:x:5:0:sync:/sbin:/bin/sync
- shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
- halt:x:7:0:halt:/sbin:/sbin/halt
- mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
- operator:x:11:0:operator:/root:/sbin/nologin
- games:x:12:100:games:/usr/games:/sbin/nologin
- ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
- nobody:x:99:99:Nobody:/:/sbin/nologin
- systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin
- dbus:x:81:81:System message bus:/:/sbin/nologin
- polkitd:x:999:998:User for polkitd:/:/sbin/nologin
- rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin
- rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
- nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
- sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
- postfix:x:89:89::/var/spool/postfix:/sbin/nologin
- chrony:x:998:996::/var/lib/chrony:/sbin/nologin
- vagrant:x:1000:1000:vagrant:/home/vagrant:/bin/bash
- vboxadd:x:997:1::/var/run/vboxadd:/bin/false
- amine:x:1001:1001::/home/amine:/bin/bash
- said:x:1002:1002::/home/said:/bin/bash
- karim:x:1003:1003::/home/karim:/bin/bash
- [root@localhost vagrant]# cat /etc/passwdusermod -L karimcat /etc/passwd echo " hamid:x:1004:1004::/home/hamid:/bin/bah sh" >> /etc/pas
- <o "hamid:x:1004:1004::/home/hamid:/bin/bash" >> /etc/pass wd
- [root@localhost vagrant]#
- <"hamid:x:1004:1004::/home/hamid:/bin/bash" >> /etc/passwd
- [root@localhost vagrant]#
- [root@localhost vagrant]# chmod +w /etc/ch shadow
- [root@localhost vagrant]# chmod +w /etc/shadow
- <"hamid:x:1004:1004::/home/hamid:/bin/bash" >> /etc/passwd
- [root@localhost vagrant]# chmod +w /etc/shadow cat /etc/shadow
- root:$1$VEt.WqKC$CamA1Xh1GBbWpR1YkSJR1/::0:99999:7:::
- bin:*:17632:0:99999:7:::
- daemon:*:17632:0:99999:7:::
- adm:*:17632:0:99999:7:::
- lp:*:17632:0:99999:7:::
- sync:*:17632:0:99999:7:::
- shutdown:*:17632:0:99999:7:::
- halt:*:17632:0:99999:7:::
- mail:*:17632:0:99999:7:::
- operator:*:17632:0:99999:7:::
- games:*:17632:0:99999:7:::
- ftp:*:17632:0:99999:7:::
- nobody:*:17632:0:99999:7:::
- systemd-network:!!:17663::::::
- dbus:!!:17663::::::
- polkitd:!!:17663::::::
- rpc:!!:17663:0:99999:7:::
- rpcuser:!!:17663::::::
- nfsnobody:!!:17663::::::
- sshd:!!:17663::::::
- postfix:!!:17663::::::
- chrony:!!:17663::::::
- vagrant:$1$xyskNOHy$fTX23HILCqtay.zv8cRaN.::0:99999:7:::
- vboxadd:!!:17795::::::
- amine:$1$yGWHQ7VT$w4PkHuEdfrlWVNwUZo/ak0:17795:0:99999:7:::
- said:$1$ZXwb4XT6$Go2YHgz5fYHFJhBu2O72m/:17795:30:99999:7:::
- karim:!!$1$lcodiPVU$R8sLJnvKqpa/yxyeVck7k.:17795:0:99999:7:::
- [root@localhost vagrant]# echo "hamid:!!:17795:0:99999:7:::" >> /etc/shadow
- bash: :17795: bad word specifier
- [root@localhost vagrant]# cat /etc/shadowhmod +w /etc/shadow
- <"hamid:x:1004:1004::/home/hamid:/bin/bash" >> /etc/passwd
- [root@localhost vagrant]# chmod +w /etc/shadow at /etc/shadow echo : cat cat /etc/shadow
- root:$1$VEt.WqKC$CamA1Xh1GBbWpR1YkSJR1/::0:99999:7:::
- bin:*:17632:0:99999:7:::
- daemon:*:17632:0:99999:7:::
- adm:*:17632:0:99999:7:::
- lp:*:17632:0:99999:7:::
- sync:*:17632:0:99999:7:::
- shutdown:*:17632:0:99999:7:::
- halt:*:17632:0:99999:7:::
- mail:*:17632:0:99999:7:::
- operator:*:17632:0:99999:7:::
- games:*:17632:0:99999:7:::
- ftp:*:17632:0:99999:7:::
- nobody:*:17632:0:99999:7:::
- systemd-network:!!:17663::::::
- dbus:!!:17663::::::
- polkitd:!!:17663::::::
- rpc:!!:17663:0:99999:7:::
- rpcuser:!!:17663::::::
- nfsnobody:!!:17663::::::
- sshd:!!:17663::::::
- postfix:!!:17663::::::
- chrony:!!:17663::::::
- vagrant:$1$xyskNOHy$fTX23HILCqtay.zv8cRaN.::0:99999:7:::
- vboxadd:!!:17795::::::
- amine:$1$yGWHQ7VT$w4PkHuEdfrlWVNwUZo/ak0:17795:0:99999:7:::
- said:$1$ZXwb4XT6$Go2YHgz5fYHFJhBu2O72m/:17795:30:99999:7:::
- karim:!!$1$lcodiPVU$R8sLJnvKqpa/yxyeVck7k.:17795:0:99999:7:::
- [root@localhost vagrant]# cat /etc/shadow hmod +w /etc/shadow echo : "hamid:!!: 'hamid:!!:17795:0:99999:7:::' >> /etc/shw=a adow
- [root@localhost vagrant]# ca t /a etc/shadow
- root:$1$VEt.WqKC$CamA1Xh1GBbWpR1YkSJR1/::0:99999:7:::
- bin:*:17632:0:99999:7:::
- daemon:*:17632:0:99999:7:::
- adm:*:17632:0:99999:7:::
- lp:*:17632:0:99999:7:::
- sync:*:17632:0:99999:7:::
- shutdown:*:17632:0:99999:7:::
- halt:*:17632:0:99999:7:::
- mail:*:17632:0:99999:7:::
- operator:*:17632:0:99999:7:::
- games:*:17632:0:99999:7:::
- ftp:*:17632:0:99999:7:::
- nobody:*:17632:0:99999:7:::
- systemd-network:!!:17663::::::
- dbus:!!:17663::::::
- polkitd:!!:17663::::::
- rpc:!!:17663:0:99999:7:::
- rpcuser:!!:17663::::::
- nfsnobody:!!:17663::::::
- sshd:!!:17663::::::
- postfix:!!:17663::::::
- chrony:!!:17663::::::
- vagrant:$1$xyskNOHy$fTX23HILCqtay.zv8cRaN.::0:99999:7:::
- vboxadd:!!:17795::::::
- amine:$1$yGWHQ7VT$w4PkHuEdfrlWVNwUZo/ak0:17795:0:99999:7:::
- said:$1$ZXwb4XT6$Go2YHgz5fYHFJhBu2O72m/:17795:30:99999:7:::
- karim:!!$1$lcodiPVU$R8sLJnvKqpa/yxyeVck7k.:17795:0:99999:7:::
- hamid:!!:17795:0:99999:7:::
- [root@localhost vagrant]# passwd hamis d
- Changing password for user hamid.
- New password:
- BAD PASSWORD: The password is shorter than 8 characters
- Retype new password:
- passwd: all authentication tokens updated successfully.
- [root@localhost vagrant]# cd /home
- [root@localhost home]# mkdor ir hamid
- [root@localhost home]# chmod L :hami mid:etudiantd :hamid:etudiant d :hamid:etudiant :hamid:etudiant o :hamid:etudiantw :hamid:etudiantn :hamid:etudiant
- [root@localhost home]# chown
- [root@localhost home]# chown :
- [root@localhost home]# chown :h
- [root@localhost home]# chown :ha
- [root@localhost home]# chown :ham
- [root@localhost home]# chown :hami
- [root@localhost home]# chown :hamid
- [root@localhost home]# chown :hamid:
- [root@localhost home]# chown :hamid:e
- [root@localhost home]# chown :hamid:et
- [root@localhost home]# chown :hamid:etu
- [root@localhost home]# chown :hamid:etud
- [root@localhost home]# chown :hamid:etudi
- [root@localhost home]# chown :hamid:etudia
- [root@localhost home]# chown :hamid:etudian
- [root@localhost home]# chown :hamid:etudiant hamid:etudiant
- [root@localhost home]# chown h
- [root@localhost home]# chown ha
- [root@localhost home]# chown ham
- [root@localhost home]# chown hami
- [root@localhost home]# chown hamid
- [root@localhost home]# chown hamid:
- [root@localhost home]# chown hamid:e
- [root@localhost home]# chown hamid:et
- [root@localhost home]# chown hamid:etu
- [root@localhost home]# chown hamid:etud
- [root@localhost home]# chown hamid:etudi
- [root@localhost home]# chown hamid:etudia
- [root@localhost home]# chown hamid:etudian
- [root@localhost home]# chown hamid:etudiant
- [root@localhost home]# chown hamid:etudiant h a mid/
- chown: invalid group: ‘hamid:etudiant’
- [root@localhost home]# ls -l
- total 0
- drwx------. 2 amine amine 97 Sep 21 21:24 [0m[01;34mamine[0m
- drwxr-xr-x. 2 root root 6 Sep 21 21:30 [01;34mhamid[0m
- drwx------. 2 karim karim 97 Sep 21 21:23 [01;34mkarim[0m
- drwx------. 2 said said 76 Sep 21 21:22 [01;34msaid[0m
- drwx------. 3 vagrant vagrant 127 Sep 21 21:21 [01;34mvagrant[0m
- [root@localhost home]# ls -lchown hamid:etudiant hamid/ s hamid/
- [root@localhost home]# chown hamid:etudiants hamid/
- [root@localhost home]# ls -l
- total 0
- drwx------. 2 amine amine 97 Sep 21 21:24 [0m[01;34mamine[0m
- drwxr-xr-x. 2 hamid etudiants 6 Sep 21 21:30 [01;34mhamid[0m
- drwx------. 2 karim karim 97 Sep 21 21:23 [01;34mkarim[0m
- drwx------. 2 said said 76 Sep 21 21:22 [01;34msaid[0m
- drwx------. 3 vagrant vagrant 127 Sep 21 21:21 [01;34mvagrant[0m
- [root@localhost home]# cp /etc/skel/ /* / hamid/
- cp: cannot stat ‘/etc/skel/*’: No such file or directory
- [root@localhost home]# cp /etc/skel/* hamid/ hamid/ . hamid/& hamid/ hamid/ * hamid/
- cp: omitting directory ‘/etc/skel/.’
- cp: omitting directory ‘/etc/skel/..’
- [root@localhost home]# cp /etc/skel/.* hamid/ hamid/
- [root@localhost home]# cp /etc/skel/.b hamid/a hamid/h hamid/ hamid/ s hamid/h hamid/s hamid/ hamid/ * hamid/
- cp: overwrite ‘hamid/.bash_logout’? ^C
- [root@localhost home]# ls -l hamid
- total 0
- [root@localhost home]# cd cd hamid
- [root@localhost hamid]# ls o -al
- total 16
- drwxr-xr-x. 2 hamid etudiants 76 Sep 21 21:31 [0m[01;34m.[0m
- drwxr-xr-x. 7 root root 72 Sep 21 21:30 [01;34m..[0m
- -rw-r--r--. 1 root root 18 Sep 21 21:31 .bash_logout
- -rw-r--r--. 1 root root 193 Sep 21 21:31 .bash_profile
- -rw-r--r--. 1 root root 231 Sep 21 21:31 .bashrc
- -rw-r--r--. 1 root root 658 Sep 21 21:31 .zshrc
- [root@localhost hamid]# rm .zshrc
- rm: remove regular file ‘.zshrc’?
- [root@localhost hamid]# exit
- [vagrant@localhost ~]$ rm .zshe rc cd ham h /home/hamid/
- [vagrant@localhost hamid]$ ls
- [vagrant@localhost hamid]$ m rm .zshrc
- rm: remove write-protected regular file ‘.zshrc’?
- [vagrant@localhost hamid]$ ls
- [vagrant@localhost hamid]$ ls -al
- total 16
- drwxr-xr-x. 2 hamid etudiants 76 Sep 21 21:31 [0m[01;34m.[0m
- drwxr-xr-x. 7 root root 72 Sep 21 21:30 [01;34m..[0m
- -rw-r--r--. 1 root root 18 Sep 21 21:31 .bash_logout
- -rw-r--r--. 1 root root 193 Sep 21 21:31 .bash_profile
- -rw-r--r--. 1 root root 231 Sep 21 21:31 .bashrc
- -rw-r--r--. 1 root root 658 Sep 21 21:31 .zshrc
- [vagrant@localhost hamid]$ s ..
- bash: ..: command not found
- [vagrant@localhost hamid]$ exit
- Script done on Fri 21 Sep 2018 09:32:27 PM UTC
Add Comment
Please, Sign In to add comment