Guest User

Untitled

a guest
Sep 21st, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.37 KB | None | 0 0
  1. Script started on Fri 21 Sep 2018 09:21:48 PM UTC
  2. [vagrant@localhost ~]$ userah dd -h -help
  3. bash: /usr/sbin/useradd: Permission denied
  4. [vagrant@localhost ~]$ su
  5. Password:
  6. [root@localhost vagrant]# useradd --help
  7. Usage: useradd [options] LOGIN
  8. useradd -D
  9. useradd -D [options]
  10.  
  11. Options:
  12. -b, --base-dir BASE_DIR base directory for the home directory of the
  13. new account
  14. -c, --comment COMMENT GECOS field of the new account
  15. -d, --home-dir HOME_DIR home directory of the new account
  16. -D, --defaults print or change default useradd configuration
  17. -e, --expiredate EXPIRE_DATE expiration date of the new account
  18. -f, --inactive INACTIVE password inactivity period of the new account
  19. -g, --gid GROUP name or ID of the primary group of the new
  20. account
  21. -G, --groups GROUPS list of supplementary groups of the new
  22. account
  23. -h, --help display this help message and exit
  24. -k, --skel SKEL_DIR use this alternative skeleton directory
  25. -K, --key KEY=VALUE override /etc/login.defs defaults
  26. -l, --no-log-init do not add the user to the lastlog and
  27. faillog databases
  28. -m, --create-home create the user's home directory
  29. -M, --no-create-home do not create the user's home directory
  30. -N, --no-user-group do not create a group with the same name as
  31. the user
  32. -o, --non-unique allow to create users with duplicate
  33. (non-unique) UID
  34. -p, --password PASSWORD encrypted password of the new account
  35. -r, --system create a system account
  36. -R, --root CHROOT_DIR directory to chroot into
  37. -s, --shell SHELL login shell of the new account
  38. -u, --uid UID user ID of the new account
  39. -U, --user-group create a group with the same name as the user
  40. -Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
  41.  
  42. [root@localhost vagrant]# vgrant a   ad       useradd -m amne  ien  ne  
  43. [root@localhost vagrant]# useradd -m said
  44. [root@localhost vagrant]# useradd -m said    karim
  45. [root@localhost vagrant]# cat /etc/shadow
  46. root:$1$VEt.WqKC$CamA1Xh1GBbWpR1YkSJR1/::0:99999:7:::
  47. bin:*:17632:0:99999:7:::
  48. daemon:*:17632:0:99999:7:::
  49. adm:*:17632:0:99999:7:::
  50. lp:*:17632:0:99999:7:::
  51. sync:*:17632:0:99999:7:::
  52. shutdown:*:17632:0:99999:7:::
  53. halt:*:17632:0:99999:7:::
  54. mail:*:17632:0:99999:7:::
  55. operator:*:17632:0:99999:7:::
  56. games:*:17632:0:99999:7:::
  57. ftp:*:17632:0:99999:7:::
  58. nobody:*:17632:0:99999:7:::
  59. systemd-network:!!:17663::::::
  60. dbus:!!:17663::::::
  61. polkitd:!!:17663::::::
  62. rpc:!!:17663:0:99999:7:::
  63. rpcuser:!!:17663::::::
  64. nfsnobody:!!:17663::::::
  65. sshd:!!:17663::::::
  66. postfix:!!:17663::::::
  67. chrony:!!:17663::::::
  68. vagrant:$1$xyskNOHy$fTX23HILCqtay.zv8cRaN.::0:99999:7:::
  69. vboxadd:!!:17795::::::
  70. amine:!!:17795:0:99999:7:::
  71. said:!!:17795:0:99999:7:::
  72. karim:!!:17795:0:99999:7:::
  73. [root@localhost vagrant]# #mo   echo "mot de pass no              No mot de pass"
  74. No mot de pass
  75. [root@localhost vagrant]# passwd amine
  76. Changing password for user amine.
  77. New password:
  78. BAD PASSWORD: The password is shorter than 8 characters
  79. Retype new password:
  80. passwd: all authentication tokens updated successfully.
  81. [root@localhost vagrant]# passwd said
  82. Changing password for user said.
  83. New password:
  84. BAD PASSWORD: The password is shorter than 8 characters
  85. Retype new password:
  86. passwd: all authentication tokens updated successfully.
  87. [root@localhost vagrant]# passwd karim
  88. Changing password for user karim.
  89. New password:
  90. BAD PASSWORD: The password is shorter than 8 characters
  91. Retype new password:
  92. passwd: all authentication tokens updated successfully.
  93. [root@localhost vagrant]# cat   cat     su karim
  94. [karim@localhost vagrant]$ groups
  95. karim
  96. [karim@localhost vagrant]$ exit
  97. [root@localhost vagrant]# groupadd etudiants
  98. [root@localhost vagrant]# usermod kai rim -G etuduants
  99. usermod: group 'etuduants' does not exist
  100. [root@localhost vagrant]# usermod karim -G etuduantsants iants
  101. [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
  102. [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
  103. [root@localhost vagrant]# su amine
  104. [amine@localhost vagrant]$ groups
  105. amine etudiants
  106. [amine@localhost vagrant]$ exit
  107. [root@localhost vagrant]# ls
  108. exo1.txt time.txt
  109. [root@localhost vagrant]# passwd -n 30 said
  110. Adjusting aging data for user said.
  111. passwd: Success
  112. [root@localhost vagrant]# passwd -l karim
  113. Locking password for user karim.
  114. passwd: Success
  115. [root@localhost vagrant]# usermod -L karim
  116. [root@localhost vagrant]# eh cho usermod -L karim"                 echo "hamid:x:1               cat /etc/a passwd
  117. root:x:0:0:root:/root:/bin/bash
  118. bin:x:1:1:bin:/bin:/sbin/nologin
  119. daemon:x:2:2:daemon:/sbin:/sbin/nologin
  120. adm:x:3:4:adm:/var/adm:/sbin/nologin
  121. lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
  122. sync:x:5:0:sync:/sbin:/bin/sync
  123. shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
  124. halt:x:7:0:halt:/sbin:/sbin/halt
  125. mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
  126. operator:x:11:0:operator:/root:/sbin/nologin
  127. games:x:12:100:games:/usr/games:/sbin/nologin
  128. ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
  129. nobody:x:99:99:Nobody:/:/sbin/nologin
  130. systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin
  131. dbus:x:81:81:System message bus:/:/sbin/nologin
  132. polkitd:x:999:998:User for polkitd:/:/sbin/nologin
  133. rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin
  134. rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
  135. nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
  136. sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
  137. postfix:x:89:89::/var/spool/postfix:/sbin/nologin
  138. chrony:x:998:996::/var/lib/chrony:/sbin/nologin
  139. vagrant:x:1000:1000:vagrant:/home/vagrant:/bin/bash
  140. vboxadd:x:997:1::/var/run/vboxadd:/bin/false
  141. amine:x:1001:1001::/home/amine:/bin/bash
  142. said:x:1002:1002::/home/said:/bin/bash
  143. karim:x:1003:1003::/home/karim:/bin/bash
  144. [root@localhost vagrant]# cat /etc/passwdusermod -L karimcat /etc/passwd  echo "  hamid:x:1004:1004::/home/hamid:/bin/bah sh" >> /etc/pas
  145. <o "hamid:x:1004:1004::/home/hamid:/bin/bash" >> /etc/pass wd
  146. [root@localhost vagrant]#
  147. <"hamid:x:1004:1004::/home/hamid:/bin/bash" >> /etc/passwd
  148. [root@localhost vagrant]#
  149.  
  150. [root@localhost vagrant]# chmod +w /etc/ch  shadow
  151. [root@localhost vagrant]# chmod +w /etc/shadow
  152. <"hamid:x:1004:1004::/home/hamid:/bin/bash" >> /etc/passwd
  153. [root@localhost vagrant]# chmod +w /etc/shadow  cat /etc/shadow
  154. root:$1$VEt.WqKC$CamA1Xh1GBbWpR1YkSJR1/::0:99999:7:::
  155. bin:*:17632:0:99999:7:::
  156. daemon:*:17632:0:99999:7:::
  157. adm:*:17632:0:99999:7:::
  158. lp:*:17632:0:99999:7:::
  159. sync:*:17632:0:99999:7:::
  160. shutdown:*:17632:0:99999:7:::
  161. halt:*:17632:0:99999:7:::
  162. mail:*:17632:0:99999:7:::
  163. operator:*:17632:0:99999:7:::
  164. games:*:17632:0:99999:7:::
  165. ftp:*:17632:0:99999:7:::
  166. nobody:*:17632:0:99999:7:::
  167. systemd-network:!!:17663::::::
  168. dbus:!!:17663::::::
  169. polkitd:!!:17663::::::
  170. rpc:!!:17663:0:99999:7:::
  171. rpcuser:!!:17663::::::
  172. nfsnobody:!!:17663::::::
  173. sshd:!!:17663::::::
  174. postfix:!!:17663::::::
  175. chrony:!!:17663::::::
  176. vagrant:$1$xyskNOHy$fTX23HILCqtay.zv8cRaN.::0:99999:7:::
  177. vboxadd:!!:17795::::::
  178. amine:$1$yGWHQ7VT$w4PkHuEdfrlWVNwUZo/ak0:17795:0:99999:7:::
  179. said:$1$ZXwb4XT6$Go2YHgz5fYHFJhBu2O72m/:17795:30:99999:7:::
  180. karim:!!$1$lcodiPVU$R8sLJnvKqpa/yxyeVck7k.:17795:0:99999:7:::
  181. [root@localhost vagrant]# echo "hamid:!!:17795:0:99999:7:::" >> /etc/shadow
  182. bash: :17795: bad word specifier
  183. [root@localhost vagrant]# cat /etc/shadowhmod +w /etc/shadow
  184. <"hamid:x:1004:1004::/home/hamid:/bin/bash" >> /etc/passwd
  185. [root@localhost vagrant]# chmod +w /etc/shadow at /etc/shadow  echo :   cat        cat /etc/shadow
  186. root:$1$VEt.WqKC$CamA1Xh1GBbWpR1YkSJR1/::0:99999:7:::
  187. bin:*:17632:0:99999:7:::
  188. daemon:*:17632:0:99999:7:::
  189. adm:*:17632:0:99999:7:::
  190. lp:*:17632:0:99999:7:::
  191. sync:*:17632:0:99999:7:::
  192. shutdown:*:17632:0:99999:7:::
  193. halt:*:17632:0:99999:7:::
  194. mail:*:17632:0:99999:7:::
  195. operator:*:17632:0:99999:7:::
  196. games:*:17632:0:99999:7:::
  197. ftp:*:17632:0:99999:7:::
  198. nobody:*:17632:0:99999:7:::
  199. systemd-network:!!:17663::::::
  200. dbus:!!:17663::::::
  201. polkitd:!!:17663::::::
  202. rpc:!!:17663:0:99999:7:::
  203. rpcuser:!!:17663::::::
  204. nfsnobody:!!:17663::::::
  205. sshd:!!:17663::::::
  206. postfix:!!:17663::::::
  207. chrony:!!:17663::::::
  208. vagrant:$1$xyskNOHy$fTX23HILCqtay.zv8cRaN.::0:99999:7:::
  209. vboxadd:!!:17795::::::
  210. amine:$1$yGWHQ7VT$w4PkHuEdfrlWVNwUZo/ak0:17795:0:99999:7:::
  211. said:$1$ZXwb4XT6$Go2YHgz5fYHFJhBu2O72m/:17795:30:99999:7:::
  212. karim:!!$1$lcodiPVU$R8sLJnvKqpa/yxyeVck7k.:17795:0:99999:7:::
  213. [root@localhost vagrant]# cat /etc/shadow  hmod +w /etc/shadow                    echo : "hamid:!!:          'hamid:!!:17795:0:99999:7:::' >> /etc/shw=a   adow
  214. [root@localhost vagrant]# ca  t /a etc/shadow
  215. root:$1$VEt.WqKC$CamA1Xh1GBbWpR1YkSJR1/::0:99999:7:::
  216. bin:*:17632:0:99999:7:::
  217. daemon:*:17632:0:99999:7:::
  218. adm:*:17632:0:99999:7:::
  219. lp:*:17632:0:99999:7:::
  220. sync:*:17632:0:99999:7:::
  221. shutdown:*:17632:0:99999:7:::
  222. halt:*:17632:0:99999:7:::
  223. mail:*:17632:0:99999:7:::
  224. operator:*:17632:0:99999:7:::
  225. games:*:17632:0:99999:7:::
  226. ftp:*:17632:0:99999:7:::
  227. nobody:*:17632:0:99999:7:::
  228. systemd-network:!!:17663::::::
  229. dbus:!!:17663::::::
  230. polkitd:!!:17663::::::
  231. rpc:!!:17663:0:99999:7:::
  232. rpcuser:!!:17663::::::
  233. nfsnobody:!!:17663::::::
  234. sshd:!!:17663::::::
  235. postfix:!!:17663::::::
  236. chrony:!!:17663::::::
  237. vagrant:$1$xyskNOHy$fTX23HILCqtay.zv8cRaN.::0:99999:7:::
  238. vboxadd:!!:17795::::::
  239. amine:$1$yGWHQ7VT$w4PkHuEdfrlWVNwUZo/ak0:17795:0:99999:7:::
  240. said:$1$ZXwb4XT6$Go2YHgz5fYHFJhBu2O72m/:17795:30:99999:7:::
  241. karim:!!$1$lcodiPVU$R8sLJnvKqpa/yxyeVck7k.:17795:0:99999:7:::
  242. hamid:!!:17795:0:99999:7:::
  243. [root@localhost vagrant]# passwd hamis d
  244. Changing password for user hamid.
  245. New password:
  246. BAD PASSWORD: The password is shorter than 8 characters
  247. Retype new password:
  248. passwd: all authentication tokens updated successfully.
  249. [root@localhost vagrant]# cd /home
  250. [root@localhost home]# mkdor  ir hamid
  251. [root@localhost home]# chmod L :hami  mid:etudiantd :hamid:etudiant d :hamid:etudiant  :hamid:etudiant o :hamid:etudiantw :hamid:etudiantn :hamid:etudiant
  252. [root@localhost home]# chown
  253. [root@localhost home]# chown :
  254. [root@localhost home]# chown :h
  255. [root@localhost home]# chown :ha
  256. [root@localhost home]# chown :ham
  257. [root@localhost home]# chown :hami
  258. [root@localhost home]# chown :hamid
  259. [root@localhost home]# chown :hamid:
  260. [root@localhost home]# chown :hamid:e
  261. [root@localhost home]# chown :hamid:et
  262. [root@localhost home]# chown :hamid:etu
  263. [root@localhost home]# chown :hamid:etud
  264. [root@localhost home]# chown :hamid:etudi
  265. [root@localhost home]# chown :hamid:etudia
  266. [root@localhost home]# chown :hamid:etudian
  267. [root@localhost home]# chown :hamid:etudiant hamid:etudiant 
  268. [root@localhost home]# chown h
  269. [root@localhost home]# chown ha
  270. [root@localhost home]# chown ham
  271. [root@localhost home]# chown hami
  272. [root@localhost home]# chown hamid
  273. [root@localhost home]# chown hamid:
  274. [root@localhost home]# chown hamid:e
  275. [root@localhost home]# chown hamid:et
  276. [root@localhost home]# chown hamid:etu
  277. [root@localhost home]# chown hamid:etud
  278. [root@localhost home]# chown hamid:etudi
  279. [root@localhost home]# chown hamid:etudia
  280. [root@localhost home]# chown hamid:etudian
  281. [root@localhost home]# chown hamid:etudiant
  282. [root@localhost home]# chown hamid:etudiant h a mid/ 
  283. chown: invalid group: ‘hamid:etudiant’
  284. [root@localhost home]# ls -l
  285. total 0
  286. drwx------. 2 amine amine 97 Sep 21 21:24 amine
  287. drwxr-xr-x. 2 root root 6 Sep 21 21:30 hamid
  288. drwx------. 2 karim karim 97 Sep 21 21:23 karim
  289. drwx------. 2 said said 76 Sep 21 21:22 said
  290. drwx------. 3 vagrant vagrant 127 Sep 21 21:21 vagrant
  291. [root@localhost home]# ls -lchown hamid:etudiant hamid/ s hamid/ 
  292. [root@localhost home]# chown hamid:etudiants hamid/
  293.  
  294. [root@localhost home]# ls -l 
  295. total 0
  296. drwx------. 2 amine amine 97 Sep 21 21:24 amine
  297. drwxr-xr-x. 2 hamid etudiants 6 Sep 21 21:30 hamid
  298. drwx------. 2 karim karim 97 Sep 21 21:23 karim
  299. drwx------. 2 said said 76 Sep 21 21:22 said
  300. drwx------. 3 vagrant vagrant 127 Sep 21 21:21 vagrant
  301. [root@localhost home]# cp /etc/skel/   /* / hamid/
  302. cp: cannot stat ‘/etc/skel/*’: No such file or directory
  303. [root@localhost home]# cp /etc/skel/* hamid/ hamid/ . hamid/& hamid/ hamid/ * hamid/
  304. cp: omitting directory ‘/etc/skel/.’
  305. cp: omitting directory ‘/etc/skel/..’
  306. [root@localhost home]# cp /etc/skel/.* hamid/ hamid/ 
  307. [root@localhost home]# cp /etc/skel/.b hamid/a hamid/h hamid/ hamid/ s hamid/h hamid/s hamid/ hamid/ * hamid/
  308. cp: overwrite ‘hamid/.bash_logout’? ^C
  309. [root@localhost home]# ls -l hamid
  310. total 0
  311. [root@localhost home]# cd    cd hamid
  312. [root@localhost hamid]# ls o -al
  313. total 16
  314. drwxr-xr-x. 2 hamid etudiants 76 Sep 21 21:31 .
  315. drwxr-xr-x. 7 root root 72 Sep 21 21:30 ..
  316. -rw-r--r--. 1 root root 18 Sep 21 21:31 .bash_logout
  317. -rw-r--r--. 1 root root 193 Sep 21 21:31 .bash_profile
  318. -rw-r--r--. 1 root root 231 Sep 21 21:31 .bashrc
  319. -rw-r--r--. 1 root root 658 Sep 21 21:31 .zshrc
  320. [root@localhost hamid]# rm .zshrc
  321. rm: remove regular file ‘.zshrc’?
  322. [root@localhost hamid]# exit
  323. [vagrant@localhost ~]$ rm .zshe rc         cd ham   h /home/hamid/
  324. [vagrant@localhost hamid]$ ls
  325. [vagrant@localhost hamid]$ m rm .zshrc
  326. rm: remove write-protected regular file ‘.zshrc’?
  327. [vagrant@localhost hamid]$ ls
  328. [vagrant@localhost hamid]$ ls -al
  329. total 16
  330. drwxr-xr-x. 2 hamid etudiants 76 Sep 21 21:31 .
  331. drwxr-xr-x. 7 root root 72 Sep 21 21:30 ..
  332. -rw-r--r--. 1 root root 18 Sep 21 21:31 .bash_logout
  333. -rw-r--r--. 1 root root 193 Sep 21 21:31 .bash_profile
  334. -rw-r--r--. 1 root root 231 Sep 21 21:31 .bashrc
  335. -rw-r--r--. 1 root root 658 Sep 21 21:31 .zshrc
  336. [vagrant@localhost hamid]$ s ..
  337. bash: ..: command not found
  338. [vagrant@localhost hamid]$ exit
  339.  
  340. Script done on Fri 21 Sep 2018 09:32:27 PM UTC
Add Comment
Please, Sign In to add comment