Advertisement
Guest User

CV3 MOTORKU

a guest
Feb 21st, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 43.52 KB | None | 0 0
  1. [user@centos7 ~]$ sudo groupadd uzivatele
  2. [sudo] password for user:
  3. [user@centos7 ~]$ sudo groupadd uzivatele
  4. groupadd: group 'uzivatele' already exists
  5. [user@centos7 ~]$ sudo /s
  6. sudo: /s: command not found
  7. [user@centos7 ~]$ sudo -s
  8. [root@centos7 user]# groups
  9. root
  10. [root@centos7 user]# groupadd uzivatele
  11. groupadd: group 'uzivatele' already exists
  12. [root@centos7 user]# cut -d:-f1 /etc/group | sort
  13. cut: the delimiter must be a single character
  14. Try 'cut --help' for more information.
  15. [root@centos7 user]# useradd -G uzivatele Adam Bednar
  16. Usage: useradd [options] LOGIN
  17. useradd -D
  18. useradd -D [options]
  19.  
  20. Options:
  21. -b, --base-dir BASE_DIR base directory for the home directory of the
  22. new account
  23. -c, --comment COMMENT GECOS field of the new account
  24. -d, --home-dir HOME_DIR home directory of the new account
  25. -D, --defaults print or change default useradd configuration
  26. -e, --expiredate EXPIRE_DATE expiration date of the new account
  27. -f, --inactive INACTIVE password inactivity period of the new account
  28. -g, --gid GROUP name or ID of the primary group of the new
  29. account
  30. -G, --groups GROUPS list of supplementary groups of the new
  31. account
  32. -h, --help display this help message and exit
  33. -k, --skel SKEL_DIR use this alternative skeleton directory
  34. -K, --key KEY=VALUE override /etc/login.defs defaults
  35. -l, --no-log-init do not add the user to the lastlog and
  36. faillog databases
  37. -m, --create-home create the user's home directory
  38. -M, --no-create-home do not create the user's home directory
  39. -N, --no-user-group do not create a group with the same name as
  40. the user
  41. -o, --non-unique allow to create users with duplicate
  42. (non-unique) UID
  43. -p, --password PASSWORD encrypted password of the new account
  44. -r, --system create a system account
  45. -R, --root CHROOT_DIR directory to chroot into
  46. -s, --shell SHELL login shell of the new account
  47. -u, --uid UID user ID of the new account
  48. -U, --user-group create a group with the same name as the user
  49. -Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
  50.  
  51. [root@centos7 user]# useradd uzivatele Adam Bednar
  52. Usage: useradd [options] LOGIN
  53. useradd -D
  54. useradd -D [options]
  55.  
  56. Options:
  57. -b, --base-dir BASE_DIR base directory for the home directory of the
  58. new account
  59. -c, --comment COMMENT GECOS field of the new account
  60. -d, --home-dir HOME_DIR home directory of the new account
  61. -D, --defaults print or change default useradd configuration
  62. -e, --expiredate EXPIRE_DATE expiration date of the new account
  63. -f, --inactive INACTIVE password inactivity period of the new account
  64. -g, --gid GROUP name or ID of the primary group of the new
  65. account
  66. -G, --groups GROUPS list of supplementary groups of the new
  67. account
  68. -h, --help display this help message and exit
  69. -k, --skel SKEL_DIR use this alternative skeleton directory
  70. -K, --key KEY=VALUE override /etc/login.defs defaults
  71. -l, --no-log-init do not add the user to the lastlog and
  72. faillog databases
  73. -m, --create-home create the user's home directory
  74. -M, --no-create-home do not create the user's home directory
  75. -N, --no-user-group do not create a group with the same name as
  76. the user
  77. -o, --non-unique allow to create users with duplicate
  78. (non-unique) UID
  79. -p, --password PASSWORD encrypted password of the new account
  80. -r, --system create a system account
  81. -R, --root CHROOT_DIR directory to chroot into
  82. -s, --shell SHELL login shell of the new account
  83. -u, --uid UID user ID of the new account
  84. -U, --user-group create a group with the same name as the user
  85. -Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
  86.  
  87. [root@centos7 user]# useradd -m -s /bin/bash -c "Adam Bednar" -g "uzivatele -p "" bednar
  88. > bednar
  89. >
  90. >
  91. > ^C
  92. [root@centos7 user]# groups
  93. root
  94. [root@centos7 user]# groupadd "uzivatele"
  95. groupadd: group 'uzivatele' already exists
  96. [root@centos7 user]# /etc/groups
  97. bash: /etc/groups: No such file or directory
  98. [root@centos7 user]# /etc
  99. bash: /etc: Is a directory
  100. [root@centos7 user]# ls etc
  101. ls: cannot access etc: No such file or directory
  102. [root@centos7 user]# ls /etc
  103. abrt gshadow- prelink.conf.d
  104. adjtime gss printcap
  105. aliases gssproxy profile
  106. aliases.db host.conf profile.d
  107. alsa hostname protocols
  108. alternatives hosts pulse
  109. anacrontab hosts.allow purple
  110. asound.conf hosts.deny python
  111. at.deny hp qemu-ga
  112. audisp httpd qemu-kvm
  113. audit idmapd.conf radvd.conf
  114. autofs.conf init.d rc0.d
  115. autofs_ldap_auth.conf inittab rc1.d
  116. auto.master inputrc rc2.d
  117. auto.master.d ipa rc3.d
  118. auto.misc iproute2 rc4.d
  119. auto.net ipsec.conf rc5.d
  120. auto.smb ipsec.d rc6.d
  121. avahi ipsec.secrets rc.d
  122. bash_completion.d iscsi rc.local
  123. bashrc issue rdma
  124. binfmt.d issue.net redhat-release
  125. bluetooth java request-key.conf
  126. brltty jvm request-key.d
  127. brltty.conf jvm-commmon resolv.conf
  128. centos-release kdump.conf rpc
  129. centos-release-upstream kernel rpm
  130. certmonger krb5.conf rsyncd.conf
  131. cgconfig.conf krb5.conf.d rsyslog.conf
  132. cgconfig.d ksmtuned.conf rsyslog.d
  133. cgrules.conf ld.so.cache rwtab
  134. cgsnapshot_blacklist.conf ld.so.conf rwtab.d
  135. chkconfig.d ld.so.conf.d samba
  136. chrony.conf libaudit.conf sane.d
  137. chrony.keys libblockdev sasl2
  138. cifs-utils libibverbs.d scl
  139. cron.d libnl securetty
  140. cron.daily libreport security
  141. cron.deny libuser.conf selinux
  142. cron.hourly libvirt services
  143. cron.monthly locale.conf sestatus.conf
  144. crontab localtime setroubleshoot
  145. cron.weekly login.defs setuptool.d
  146. crypttab logrotate.conf sgml
  147. csh.cshrc logrotate.d shadow
  148. csh.login lsm shadow-
  149. cups lvm shells
  150. cupshelpers machine-id skel
  151. dbus-1 magic smartmontools
  152. dconf mailcap smi.conf
  153. default mail.rc sos.conf
  154. depmod.d makedumpfile.conf.sample speech-dispatcher
  155. dhcp man_db.conf ssh
  156. DIR_COLORS maven ssl
  157. DIR_COLORS.256color mime.types sssd
  158. DIR_COLORS.lightbgcolor mke2fs.conf statetab
  159. dleyna-server-service.conf modprobe.d statetab.d
  160. dnsmasq.conf modules-load.d subgid
  161. dnsmasq.d motd subuid
  162. dracut.conf mtab sudo.conf
  163. dracut.conf.d mtools.conf sudoers
  164. drirc multipath sudoers.d
  165. e2fsck.conf my.cnf sudo-ldap.conf
  166. enscript.cfg my.cnf.d sysconfig
  167. environment nanorc sysctl.conf
  168. ethertypes netconfig sysctl.d
  169. exports NetworkManager systemd
  170. exports.d networks system-release
  171. favicon.png nfs.conf system-release-cpe
  172. fcoe nfsmount.conf target
  173. festival nsswitch.conf tcsd.conf
  174. filesystems nsswitch.conf.bak terminfo
  175. firefox ntp tmpfiles.d
  176. firewalld ntp.conf trusted-key.key
  177. flatpak numad.conf tuned
  178. fonts oddjob udev
  179. fprintd.conf oddjobd.conf udisks2
  180. fstab oddjobd.conf.d unbound
  181. fuse.conf openldap updatedb.conf
  182. gconf opt UPower
  183. gcrypt os-release usb_modeswitch.conf
  184. gdbinit PackageKit vconsole.conf
  185. gdbinit.d pam.d vimrc
  186. gdm passwd virc
  187. geoclue passwd- vmware-tools
  188. GeoIP.conf pbm2ppa.conf wgetrc
  189. GeoIP.conf.default pinforc wpa_supplicant
  190. ghostscript pkcs11 wvdial.conf
  191. gnupg pki X11
  192. GREP_COLORS plymouth xdg
  193. groff pm xinetd.d
  194. group pnm2ppa.conf xml
  195. group- polkit-1 yum
  196. grub2.cfg popt.d yum.conf
  197. grub.d postfix yum.repos.d
  198. gshadow ppp
  199. [root@centos7 user]# ls /etc/group
  200. /etc/group
  201. [root@centos7 user]# cat /etc/group
  202. root:x:0:
  203. bin:x:1:
  204. daemon:x:2:
  205. sys:x:3:
  206. adm:x:4:
  207. tty:x:5:
  208. disk:x:6:
  209. lp:x:7:
  210. mem:x:8:
  211. kmem:x:9:
  212. wheel:x:10:user
  213. cdrom:x:11:
  214. mail:x:12:postfix
  215. man:x:15:
  216. dialout:x:18:
  217. floppy:x:19:
  218. games:x:20:
  219. tape:x:30:
  220. video:x:39:
  221. ftp:x:50:
  222. lock:x:54:
  223. audio:x:63:
  224. nobody:x:99:
  225. users:x:100:
  226. utmp:x:22:
  227. utempter:x:35:
  228. ssh_keys:x:999:
  229. input:x:998:
  230. systemd-journal:x:190:
  231. systemd-network:x:192:
  232. dbus:x:81:
  233. polkitd:x:997:
  234. postdrop:x:90:
  235. postfix:x:89:
  236. sshd:x:74:
  237. tss:x:59:
  238. wireshark:x:996:
  239. cgred:x:995:
  240. printadmin:x:994:
  241. rpc:x:32:
  242. gluster:x:993:
  243. dip:x:40:
  244. libstoragemgmt:x:992:
  245. unbound:x:991:
  246. kvm:x:36:qemu
  247. qemu:x:107:
  248. usbmuxd:x:113:
  249. chrony:x:990:
  250. rtkit:x:172:
  251. radvd:x:75:
  252. ntp:x:38:
  253. colord:x:989:
  254. abrt:x:173:
  255. geoclue:x:988:
  256. saslauth:x:76:
  257. libvirt:x:987:
  258. pulse-access:x:986:
  259. pulse-rt:x:985:
  260. pulse:x:171:
  261. gdm:x:42:
  262. setroubleshoot:x:984:
  263. rpcuser:x:29:
  264. nfsnobody:x:65534:
  265. sssd:x:983:
  266. stapusr:x:156:
  267. stapsys:x:157:
  268. stapdev:x:158:
  269. gnome-initial-setup:x:982:
  270. avahi:x:70:
  271. slocate:x:21:
  272. tcpdump:x:72:
  273. user:x:1000:
  274. apache:x:48:
  275. uzivatele:x:1001:
  276. [root@centos7 user]# useradd -g "uzivatele" Adam Bednar
  277. Usage: useradd [options] LOGIN
  278. useradd -D
  279. useradd -D [options]
  280.  
  281. Options:
  282. -b, --base-dir BASE_DIR base directory for the home directory of the
  283. new account
  284. -c, --comment COMMENT GECOS field of the new account
  285. -d, --home-dir HOME_DIR home directory of the new account
  286. -D, --defaults print or change default useradd configuration
  287. -e, --expiredate EXPIRE_DATE expiration date of the new account
  288. -f, --inactive INACTIVE password inactivity period of the new account
  289. -g, --gid GROUP name or ID of the primary group of the new
  290. account
  291. -G, --groups GROUPS list of supplementary groups of the new
  292. account
  293. -h, --help display this help message and exit
  294. -k, --skel SKEL_DIR use this alternative skeleton directory
  295. -K, --key KEY=VALUE override /etc/login.defs defaults
  296. -l, --no-log-init do not add the user to the lastlog and
  297. faillog databases
  298. -m, --create-home create the user's home directory
  299. -M, --no-create-home do not create the user's home directory
  300. -N, --no-user-group do not create a group with the same name as
  301. the user
  302. -o, --non-unique allow to create users with duplicate
  303. (non-unique) UID
  304. -p, --password PASSWORD encrypted password of the new account
  305. -r, --system create a system account
  306. -R, --root CHROOT_DIR directory to chroot into
  307. -s, --shell SHELL login shell of the new account
  308. -u, --uid UID user ID of the new account
  309. -U, --user-group create a group with the same name as the user
  310. -Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
  311.  
  312. [root@centos7 user]# useradd
  313. Usage: useradd [options] LOGIN
  314. useradd -D
  315. useradd -D [options]
  316.  
  317. Options:
  318. -b, --base-dir BASE_DIR base directory for the home directory of the
  319. new account
  320. -c, --comment COMMENT GECOS field of the new account
  321. -d, --home-dir HOME_DIR home directory of the new account
  322. -D, --defaults print or change default useradd configuration
  323. -e, --expiredate EXPIRE_DATE expiration date of the new account
  324. -f, --inactive INACTIVE password inactivity period of the new account
  325. -g, --gid GROUP name or ID of the primary group of the new
  326. account
  327. -G, --groups GROUPS list of supplementary groups of the new
  328. account
  329. -h, --help display this help message and exit
  330. -k, --skel SKEL_DIR use this alternative skeleton directory
  331. -K, --key KEY=VALUE override /etc/login.defs defaults
  332. -l, --no-log-init do not add the user to the lastlog and
  333. faillog databases
  334. -m, --create-home create the user's home directory
  335. -M, --no-create-home do not create the user's home directory
  336. -N, --no-user-group do not create a group with the same name as
  337. the user
  338. -o, --non-unique allow to create users with duplicate
  339. (non-unique) UID
  340. -p, --password PASSWORD encrypted password of the new account
  341. -r, --system create a system account
  342. -R, --root CHROOT_DIR directory to chroot into
  343. -s, --shell SHELL login shell of the new account
  344. -u, --uid UID user ID of the new account
  345. -U, --user-group create a group with the same name as the user
  346. -Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
  347.  
  348. [root@centos7 user]# useradd -a -G "uzivatele" Adam Bednar
  349. useradd: invalid option -- 'a'
  350. Usage: useradd [options] LOGIN
  351. useradd -D
  352. useradd -D [options]
  353.  
  354. Options:
  355. -b, --base-dir BASE_DIR base directory for the home directory of the
  356. new account
  357. -c, --comment COMMENT GECOS field of the new account
  358. -d, --home-dir HOME_DIR home directory of the new account
  359. -D, --defaults print or change default useradd configuration
  360. -e, --expiredate EXPIRE_DATE expiration date of the new account
  361. -f, --inactive INACTIVE password inactivity period of the new account
  362. -g, --gid GROUP name or ID of the primary group of the new
  363. account
  364. -G, --groups GROUPS list of supplementary groups of the new
  365. account
  366. -h, --help display this help message and exit
  367. -k, --skel SKEL_DIR use this alternative skeleton directory
  368. -K, --key KEY=VALUE override /etc/login.defs defaults
  369. -l, --no-log-init do not add the user to the lastlog and
  370. faillog databases
  371. -m, --create-home create the user's home directory
  372. -M, --no-create-home do not create the user's home directory
  373. -N, --no-user-group do not create a group with the same name as
  374. the user
  375. -o, --non-unique allow to create users with duplicate
  376. (non-unique) UID
  377. -p, --password PASSWORD encrypted password of the new account
  378. -r, --system create a system account
  379. -R, --root CHROOT_DIR directory to chroot into
  380. -s, --shell SHELL login shell of the new account
  381. -u, --uid UID user ID of the new account
  382. -U, --user-group create a group with the same name as the user
  383. -Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
  384.  
  385. [root@centos7 user]# members uzivatele
  386. bash: members: command not found...
  387. [root@centos7 user]# sudo apt-get install members
  388. sudo: apt-get: command not found
  389. [root@centos7 user]# groups
  390. root
  391. [root@centos7 user]# uzivatele
  392. bash: uzivatele: command not found...
  393. [root@centos7 user]# group uzivatele
  394. bash: group: command not found...
  395. [root@centos7 user]# getent
  396. getent: wrong number of arguments
  397. Try `getent --help' or `getent --usage' for more information.
  398. [root@centos7 user]# getent group uzivatele
  399. uzivatele:x:1001:
  400. [root@centos7 user]# grep uzivatele /etc/group
  401. uzivatele:x:1001:
  402. [root@centos7 user]# useradd -a -G uzivatele Adam Bednar
  403. useradd: invalid option -- 'a'
  404. Usage: useradd [options] LOGIN
  405. useradd -D
  406. useradd -D [options]
  407.  
  408. Options:
  409. -b, --base-dir BASE_DIR base directory for the home directory of the
  410. new account
  411. -c, --comment COMMENT GECOS field of the new account
  412. -d, --home-dir HOME_DIR home directory of the new account
  413. -D, --defaults print or change default useradd configuration
  414. -e, --expiredate EXPIRE_DATE expiration date of the new account
  415. -f, --inactive INACTIVE password inactivity period of the new account
  416. -g, --gid GROUP name or ID of the primary group of the new
  417. account
  418. -G, --groups GROUPS list of supplementary groups of the new
  419. account
  420. -h, --help display this help message and exit
  421. -k, --skel SKEL_DIR use this alternative skeleton directory
  422. -K, --key KEY=VALUE override /etc/login.defs defaults
  423. -l, --no-log-init do not add the user to the lastlog and
  424. faillog databases
  425. -m, --create-home create the user's home directory
  426. -M, --no-create-home do not create the user's home directory
  427. -N, --no-user-group do not create a group with the same name as
  428. the user
  429. -o, --non-unique allow to create users with duplicate
  430. (non-unique) UID
  431. -p, --password PASSWORD encrypted password of the new account
  432. -r, --system create a system account
  433. -R, --root CHROOT_DIR directory to chroot into
  434. -s, --shell SHELL login shell of the new account
  435. -u, --uid UID user ID of the new account
  436. -U, --user-group create a group with the same name as the user
  437. -Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
  438.  
  439. [root@centos7 user]# useradd -a -G "uzivatele" "Adam Bednar"
  440. useradd: invalid option -- 'a'
  441. Usage: useradd [options] LOGIN
  442. useradd -D
  443. useradd -D [options]
  444.  
  445. Options:
  446. -b, --base-dir BASE_DIR base directory for the home directory of the
  447. new account
  448. -c, --comment COMMENT GECOS field of the new account
  449. -d, --home-dir HOME_DIR home directory of the new account
  450. -D, --defaults print or change default useradd configuration
  451. -e, --expiredate EXPIRE_DATE expiration date of the new account
  452. -f, --inactive INACTIVE password inactivity period of the new account
  453. -g, --gid GROUP name or ID of the primary group of the new
  454. account
  455. -G, --groups GROUPS list of supplementary groups of the new
  456. account
  457. -h, --help display this help message and exit
  458. -k, --skel SKEL_DIR use this alternative skeleton directory
  459. -K, --key KEY=VALUE override /etc/login.defs defaults
  460. -l, --no-log-init do not add the user to the lastlog and
  461. faillog databases
  462. -m, --create-home create the user's home directory
  463. -M, --no-create-home do not create the user's home directory
  464. -N, --no-user-group do not create a group with the same name as
  465. the user
  466. -o, --non-unique allow to create users with duplicate
  467. (non-unique) UID
  468. -p, --password PASSWORD encrypted password of the new account
  469. -r, --system create a system account
  470. -R, --root CHROOT_DIR directory to chroot into
  471. -s, --shell SHELL login shell of the new account
  472. -u, --uid UID user ID of the new account
  473. -U, --user-group create a group with the same name as the user
  474. -Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
  475.  
  476. [root@centos7 user]# useradd -a -G "uzivatele" "Cyril Duda "
  477. useradd: invalid option -- 'a'
  478. Usage: useradd [options] LOGIN
  479. useradd -D
  480. useradd -D [options]
  481.  
  482. Options:
  483. -b, --base-dir BASE_DIR base directory for the home directory of the
  484. new account
  485. -c, --comment COMMENT GECOS field of the new account
  486. -d, --home-dir HOME_DIR home directory of the new account
  487. -D, --defaults print or change default useradd configuration
  488. -e, --expiredate EXPIRE_DATE expiration date of the new account
  489. -f, --inactive INACTIVE password inactivity period of the new account
  490. -g, --gid GROUP name or ID of the primary group of the new
  491. account
  492. -G, --groups GROUPS list of supplementary groups of the new
  493. account
  494. -h, --help display this help message and exit
  495. -k, --skel SKEL_DIR use this alternative skeleton directory
  496. -K, --key KEY=VALUE override /etc/login.defs defaults
  497. -l, --no-log-init do not add the user to the lastlog and
  498. faillog databases
  499. -m, --create-home create the user's home directory
  500. -M, --no-create-home do not create the user's home directory
  501. -N, --no-user-group do not create a group with the same name as
  502. the user
  503. -o, --non-unique allow to create users with duplicate
  504. (non-unique) UID
  505. -p, --password PASSWORD encrypted password of the new account
  506. -r, --system create a system account
  507. -R, --root CHROOT_DIR directory to chroot into
  508. -s, --shell SHELL login shell of the new account
  509. -u, --uid UID user ID of the new account
  510. -U, --user-group create a group with the same name as the user
  511. -Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
  512.  
  513. [root@centos7 user]# grep uzivatele /etc/group
  514. uzivatele:x:1001:
  515. [root@centos7 user]# useradd -m -s /bin/bash -a "Adam Bednar" -G "uzivatele"
  516. useradd: invalid option -- 'a'
  517. Usage: useradd [options] LOGIN
  518. useradd -D
  519. useradd -D [options]
  520.  
  521. Options:
  522. -b, --base-dir BASE_DIR base directory for the home directory of the
  523. new account
  524. -c, --comment COMMENT GECOS field of the new account
  525. -d, --home-dir HOME_DIR home directory of the new account
  526. -D, --defaults print or change default useradd configuration
  527. -e, --expiredate EXPIRE_DATE expiration date of the new account
  528. -f, --inactive INACTIVE password inactivity period of the new account
  529. -g, --gid GROUP name or ID of the primary group of the new
  530. account
  531. -G, --groups GROUPS list of supplementary groups of the new
  532. account
  533. -h, --help display this help message and exit
  534. -k, --skel SKEL_DIR use this alternative skeleton directory
  535. -K, --key KEY=VALUE override /etc/login.defs defaults
  536. -l, --no-log-init do not add the user to the lastlog and
  537. faillog databases
  538. -m, --create-home create the user's home directory
  539. -M, --no-create-home do not create the user's home directory
  540. -N, --no-user-group do not create a group with the same name as
  541. the user
  542. -o, --non-unique allow to create users with duplicate
  543. (non-unique) UID
  544. -p, --password PASSWORD encrypted password of the new account
  545. -r, --system create a system account
  546. -R, --root CHROOT_DIR directory to chroot into
  547. -s, --shell SHELL login shell of the new account
  548. -u, --uid UID user ID of the new account
  549. -U, --user-group create a group with the same name as the user
  550. -Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
  551.  
  552. [root@centos7 user]# sudo groupadd uzivatele1
  553. [root@centos7 user]# sudo useradd -a -G uzivatele1 "Adam Bednar"
  554. useradd: invalid option -- 'a'
  555. Usage: useradd [options] LOGIN
  556. useradd -D
  557. useradd -D [options]
  558.  
  559. Options:
  560. -b, --base-dir BASE_DIR base directory for the home directory of the
  561. new account
  562. -c, --comment COMMENT GECOS field of the new account
  563. -d, --home-dir HOME_DIR home directory of the new account
  564. -D, --defaults print or change default useradd configuration
  565. -e, --expiredate EXPIRE_DATE expiration date of the new account
  566. -f, --inactive INACTIVE password inactivity period of the new account
  567. -g, --gid GROUP name or ID of the primary group of the new
  568. account
  569. -G, --groups GROUPS list of supplementary groups of the new
  570. account
  571. -h, --help display this help message and exit
  572. -k, --skel SKEL_DIR use this alternative skeleton directory
  573. -K, --key KEY=VALUE override /etc/login.defs defaults
  574. -l, --no-log-init do not add the user to the lastlog and
  575. faillog databases
  576. -m, --create-home create the user's home directory
  577. -M, --no-create-home do not create the user's home directory
  578. -N, --no-user-group do not create a group with the same name as
  579. the user
  580. -o, --non-unique allow to create users with duplicate
  581. (non-unique) UID
  582. -p, --password PASSWORD encrypted password of the new account
  583. -r, --system create a system account
  584. -R, --root CHROOT_DIR directory to chroot into
  585. -s, --shell SHELL login shell of the new account
  586. -u, --uid UID user ID of the new account
  587. -U, --user-group create a group with the same name as the user
  588. -Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
  589.  
  590. [root@centos7 user]# useradd -G "uzivatele" "Adam Bednar"
  591. useradd: invalid user name 'Adam Bednar'
  592. [root@centos7 user]# useradd -g "uzivatele" "Adam Bednar"
  593. useradd: invalid user name 'Adam Bednar'
  594. [root@centos7 user]# grep uzivatele /etc/group
  595. uzivatele:x:1001:
  596. uzivatele1:x:1002:
  597. [root@centos7 user]# sudo useradd -g "uzivatele" "Adam Bednar"
  598. useradd: invalid user name 'Adam Bednar'
  599. [root@centos7 user]# usermod
  600. Usage: usermod [options] LOGIN
  601.  
  602. Options:
  603. -c, --comment COMMENT new value of the GECOS field
  604. -d, --home HOME_DIR new home directory for the user account
  605. -e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
  606. -f, --inactive INACTIVE set password inactive after expiration
  607. to INACTIVE
  608. -g, --gid GROUP force use GROUP as new primary group
  609. -G, --groups GROUPS new list of supplementary GROUPS
  610. -a, --append append the user to the supplemental GROUPS
  611. mentioned by the -G option without removing
  612. him/her from other groups
  613. -h, --help display this help message and exit
  614. -l, --login NEW_LOGIN new value of the login name
  615. -L, --lock lock the user account
  616. -m, --move-home move contents of the home directory to the
  617. new location (use only with -d)
  618. -o, --non-unique allow using duplicate (non-unique) UID
  619. -p, --password PASSWORD use encrypted password for the new password
  620. -R, --root CHROOT_DIR directory to chroot into
  621. -s, --shell SHELL new login shell for the user account
  622. -u, --uid UID new UID for the user account
  623. -U, --unlock unlock the user account
  624. -Z, --selinux-user SEUSER new SELinux user mapping for the user account
  625.  
  626. [root@centos7 user]# sudo usermod -a -G uzivatele "Adam Bednar"
  627. usermod: user 'Adam Bednar' does not exist
  628. [root@centos7 user]# sudo usermod -a -G uzivatele Adam Bednar
  629. Usage: usermod [options] LOGIN
  630.  
  631. Options:
  632. -c, --comment COMMENT new value of the GECOS field
  633. -d, --home HOME_DIR new home directory for the user account
  634. -e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
  635. -f, --inactive INACTIVE set password inactive after expiration
  636. to INACTIVE
  637. -g, --gid GROUP force use GROUP as new primary group
  638. -G, --groups GROUPS new list of supplementary GROUPS
  639. -a, --append append the user to the supplemental GROUPS
  640. mentioned by the -G option without removing
  641. him/her from other groups
  642. -h, --help display this help message and exit
  643. -l, --login NEW_LOGIN new value of the login name
  644. -L, --lock lock the user account
  645. -m, --move-home move contents of the home directory to the
  646. new location (use only with -d)
  647. -o, --non-unique allow using duplicate (non-unique) UID
  648. -p, --password PASSWORD use encrypted password for the new password
  649. -R, --root CHROOT_DIR directory to chroot into
  650. -s, --shell SHELL new login shell for the user account
  651. -u, --uid UID new UID for the user account
  652. -U, --unlock unlock the user account
  653. -Z, --selinux-user SEUSER new SELinux user mapping for the user account
  654.  
  655. [root@centos7 user]# sudo usermod -a -G "uzivatele" "Adam Bednar"
  656. usermod: user 'Adam Bednar' does not exist
  657. [root@centos7 user]# sudo useradd -g "uzivatele" "Adam Bednar"
  658. useradd: invalid user name 'Adam Bednar'
  659. [root@centos7 user]# sudo useradd -g "uzivatele" "AdamBednar" adam.bednar
  660. Usage: useradd [options] LOGIN
  661. useradd -D
  662. useradd -D [options]
  663.  
  664. Options:
  665. -b, --base-dir BASE_DIR base directory for the home directory of the
  666. new account
  667. -c, --comment COMMENT GECOS field of the new account
  668. -d, --home-dir HOME_DIR home directory of the new account
  669. -D, --defaults print or change default useradd configuration
  670. -e, --expiredate EXPIRE_DATE expiration date of the new account
  671. -f, --inactive INACTIVE password inactivity period of the new account
  672. -g, --gid GROUP name or ID of the primary group of the new
  673. account
  674. -G, --groups GROUPS list of supplementary groups of the new
  675. account
  676. -h, --help display this help message and exit
  677. -k, --skel SKEL_DIR use this alternative skeleton directory
  678. -K, --key KEY=VALUE override /etc/login.defs defaults
  679. -l, --no-log-init do not add the user to the lastlog and
  680. faillog databases
  681. -m, --create-home create the user's home directory
  682. -M, --no-create-home do not create the user's home directory
  683. -N, --no-user-group do not create a group with the same name as
  684. the user
  685. -o, --non-unique allow to create users with duplicate
  686. (non-unique) UID
  687. -p, --password PASSWORD encrypted password of the new account
  688. -r, --system create a system account
  689. -R, --root CHROOT_DIR directory to chroot into
  690. -s, --shell SHELL login shell of the new account
  691. -u, --uid UID user ID of the new account
  692. -U, --user-group create a group with the same name as the user
  693. -Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
  694.  
  695. [root@centos7 user]# sudo useradd -g "uzivatele" adam.bednar
  696. [root@centos7 user]# grep uzivatele /etc/group
  697. uzivatele:x:1001:
  698. uzivatele1:x:1002:
  699. [root@centos7 user]# ls /home
  700. adam.bednar user
  701. [root@centos7 user]# sudo useradd -g "uzivatele" bohumil.coufal
  702. [root@centos7 user]# sudo useradd -g "uzivatele" cyril.duda
  703. [root@centos7 user]# sudo useradd -g "uzivatele" david.egrt
  704. [root@centos7 user]# sudo useradd -g "uzivatele" eva.filova
  705. [root@centos7 user]# ls /home
  706. adam.bednar bohumil.coufal cyril.duda david.egrt eva.filova user
  707. [root@centos7 user]# grep uzivatele /etc/group
  708. uzivatele:x:1001:
  709. uzivatele1:x:1002:
  710. [root@centos7 user]# sudo useradd -g uzivatele eva.filova
  711. useradd: user 'eva.filova' already exists
  712. [root@centos7 user]# sudo usermod -a -G uzivatele adam.bednar
  713. [root@centos7 user]# grep uzivatele /etc/group
  714. uzivatele:x:1001:adam.bednar
  715. uzivatele1:x:1002:
  716. [root@centos7 user]# sudo usermod -a -G uzivatele bohumil.coufal
  717. [root@centos7 user]# sudo usermod -a -G uzivatele cyril.duda
  718. [root@centos7 user]# sudo usermod -a -G uzivatele david.egrt
  719. [root@centos7 user]# sudo usermod -a -G uzivatele eva.filova
  720. [root@centos7 user]# grep uzivatele /etc/group
  721. uzivatele:x:1001:adam.bednar,bohumil.coufal,cyril.duda,david.egrt,eva.filova
  722. uzivatele1:x:1002:
  723. [root@centos7 user]# sudo passwd adam.bednar
  724. Changing password for user adam.bednar.
  725. New password:
  726. BAD PASSWORD: The password is shorter than 8 characters
  727. Retype new password:
  728. Sorry, passwords do not match.
  729. New password:
  730. BAD PASSWORD: The password contains the user name in some form
  731. Retype new password:
  732. Sorry, passwords do not match.
  733. New password:
  734. [root@centos7 user]# sudo passwd adam.bednar
  735. Changing password for user adam.bednar.
  736. New password:
  737. BAD PASSWORD: The password is shorter than 8 characters
  738. Retype new password:
  739. passwd: all authentication tokens updated successfully.
  740. [root@centos7 user]# sudo chage --list adam.bednar
  741. Last password change : Feb 21, 2019
  742. Password expires : never
  743. Password inactive : never
  744. Account expires : never
  745. Minimum number of days between password change : 0
  746. Maximum number of days between password change : 99999
  747. Number of days of warning before password expires : 7
  748. [root@centos7 user]# sudo chage -d 0 adam.bednar
  749. [root@centos7 user]# sudo chage --list adam.bednar
  750. Last password change : password must be changed
  751. Password expires : password must be changed
  752. Password inactive : password must be changed
  753. Account expires : never
  754. Minimum number of days between password change : 0
  755. Maximum number of days between password change : 99999
  756. Number of days of warning before password expires : 7
  757. [root@centos7 user]# su adam.bednar
  758. [adam.bednar@centos7 user]$ dsds
  759. bash: dsds: command not found...
  760. [adam.bednar@centos7 user]$ sudo
  761. usage: sudo -h | -K | -k | -V
  762. usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
  763. usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user] [command]
  764. usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt] [-u
  765. user] [VAR=value] [-i|-s] [<command>]
  766. usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt] [-u
  767. user] file ...
  768. [adam.bednar@centos7 user]$ su root
  769. Password:
  770. su: Authentication failure
  771. [adam.bednar@centos7 user]$ sudo passwd adam.bednar
  772.  
  773. We trust you have received the usual lecture from the local System
  774. Administrator. It usually boils down to these three things:
  775.  
  776. #1) Respect the privacy of others.
  777. #2) Think before you type.
  778. #3) With great power comes great responsibility.
  779.  
  780. [sudo] password for adam.bednar:
  781. sudo: Account or password is expired, reset your password and try again
  782. Changing password for adam.bednar.
  783. (current) UNIX password:
  784. New password:
  785. BAD PASSWORD: The password is too similar to the old one
  786. New password:
  787. BAD PASSWORD: The password is too similar to the old one
  788. New password:
  789. Retype new password:
  790. adam.bednar is not in the sudoers file. This incident will be reported.
  791. [adam.bednar@centos7 user]$ su sudo
  792. su: user sudo does not exist
  793. [adam.bednar@centos7 user]$ su root
  794. Password:
  795. su: Authentication failure
  796. [adam.bednar@centos7 user]$ grep uzivatele /etc/group
  797. uzivatele:x:1001:adam.bednar,bohumil.coufal,cyril.duda,david.egrt,eva.filova
  798. uzivatele1:x:1002:
  799. [adam.bednar@centos7 user]$ sudo passwd adam.bednar
  800. [sudo] password for adam.bednar:
  801. adam.bednar is not in the sudoers file. This incident will be reported.
  802. [adam.bednar@centos7 user]$ su user
  803. Password:
  804. [user@centos7 ~]$ sudo -s
  805. [sudo] password for user:
  806. [root@centos7 user]# sudo passwd adam.bednar
  807. Changing password for user adam.bednar.
  808. New password:
  809. BAD PASSWORD: The password contains the user name in some form
  810. Retype new password:
  811. passwd: all authentication tokens updated successfully.
  812. [root@centos7 user]# sudo chage --list adam.bednar
  813. Last password change : Feb 21, 2019
  814. Password expires : never
  815. Password inactive : never
  816. Account expires : never
  817. Minimum number of days between password change : 0
  818. Maximum number of days between password change : 99999
  819. Number of days of warning before password expires : 7
  820. [root@centos7 user]# sudo chage -d 0 adam.bednar
  821. [root@centos7 user]# sudo chage --list adam.bednar
  822. Last password change : password must be changed
  823. Password expires : password must be changed
  824. Password inactive : password must be changed
  825. Account expires : never
  826. Minimum number of days between password change : 0
  827. Maximum number of days between password change : 99999
  828. Number of days of warning before password expires : 7
  829. [root@centos7 user]# su adam.bednar
  830. [adam.bednar@centos7 user]$ su user
  831. Password:
  832. [user@centos7 ~]$ sudo -s
  833. [root@centos7 user]# sudo mkdir /home/adam.bednar/groupshare
  834. [root@centos7 user]# sudo mkdir /home/home
  835. [root@centos7 user]# ls /home
  836. adam.bednar bohumil.coufal cyril.duda david.egrt eva.filova home user
  837. [root@centos7 user]# ls /home/home
  838. [root@centos7 user]# ls /adam.bednar
  839. ls: cannot access /adam.bednar: No such file or directory
  840. [root@centos7 user]# ls adam.bednar
  841. ls: cannot access adam.bednar: No such file or directory
  842. [root@centos7 user]# sudo mkdir groupshare
  843. [root@centos7 user]# ls /home
  844. adam.bednar bohumil.coufal cyril.duda david.egrt eva.filova home user
  845. [root@centos7 user]# cd /home
  846. [root@centos7 home]# sudo mkdir groupshare
  847. [root@centos7 home]# ls /home
  848. adam.bednar bohumil.coufal cyril.duda david.egrt eva.filova groupshare home user
  849. [root@centos7 home]# man chmod
  850. [root@centos7 home]# chmod 770 groupshare
  851. [root@centos7 home]# sudo chmod 770 groupshare
  852. [root@centos7 home]# sudo mkdir publicshare
  853. [root@centos7 home]# sudo chmod 777 publicshare
  854. [root@centos7 home]# sudo chown user publicshare
  855. [root@centos7 home]# sudo useradd -m adam.bednar
  856. useradd: user 'adam.bednar' already exists
  857. [root@centos7 home]# usermod
  858. Usage: usermod [options] LOGIN
  859.  
  860. Options:
  861. -c, --comment COMMENT new value of the GECOS field
  862. -d, --home HOME_DIR new home directory for the user account
  863. -e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
  864. -f, --inactive INACTIVE set password inactive after expiration
  865. to INACTIVE
  866. -g, --gid GROUP force use GROUP as new primary group
  867. -G, --groups GROUPS new list of supplementary GROUPS
  868. -a, --append append the user to the supplemental GROUPS
  869. mentioned by the -G option without removing
  870. him/her from other groups
  871. -h, --help display this help message and exit
  872. -l, --login NEW_LOGIN new value of the login name
  873. -L, --lock lock the user account
  874. -m, --move-home move contents of the home directory to the
  875. new location (use only with -d)
  876. -o, --non-unique allow using duplicate (non-unique) UID
  877. -p, --password PASSWORD use encrypted password for the new password
  878. -R, --root CHROOT_DIR directory to chroot into
  879. -s, --shell SHELL new login shell for the user account
  880. -u, --uid UID new UID for the user account
  881. -U, --unlock unlock the user account
  882. -Z, --selinux-user SEUSER new SELinux user mapping for the user account
  883.  
  884. [root@centos7 home]# sudo mkdir adam.bednar
  885. mkdir: cannot create directory ‘adam.bednar’: File exists
  886. [root@centos7 home]# sudo mkdir adam.bednar/readonlz
  887. [root@centos7 home]# sudo mkdir adam.bednar/readonly
  888. [root@centos7 home]# ls .
  889. adam.bednar cyril.duda eva.filova home user
  890. bohumil.coufal david.egrt groupshare publicshare
  891. [root@centos7 home]# ls ./adam.bednar
  892. groupshare readonly readonlz
  893. [root@centos7 home]# sudo chmod 3444 ./adam.bednar/readonly
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement