Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [user@centos7 ~]$ sudo groupadd uzivatele
- [sudo] password for user:
- [user@centos7 ~]$ sudo groupadd uzivatele
- groupadd: group 'uzivatele' already exists
- [user@centos7 ~]$ sudo /s
- sudo: /s: command not found
- [user@centos7 ~]$ sudo -s
- [root@centos7 user]# groups
- root
- [root@centos7 user]# groupadd uzivatele
- groupadd: group 'uzivatele' already exists
- [root@centos7 user]# cut -d:-f1 /etc/group | sort
- cut: the delimiter must be a single character
- Try 'cut --help' for more information.
- [root@centos7 user]# useradd -G uzivatele Adam Bednar
- 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@centos7 user]# useradd uzivatele Adam Bednar
- 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@centos7 user]# useradd -m -s /bin/bash -c "Adam Bednar" -g "uzivatele -p "" bednar
- > bednar
- >
- >
- > ^C
- [root@centos7 user]# groups
- root
- [root@centos7 user]# groupadd "uzivatele"
- groupadd: group 'uzivatele' already exists
- [root@centos7 user]# /etc/groups
- bash: /etc/groups: No such file or directory
- [root@centos7 user]# /etc
- bash: /etc: Is a directory
- [root@centos7 user]# ls etc
- ls: cannot access etc: No such file or directory
- [root@centos7 user]# ls /etc
- abrt gshadow- prelink.conf.d
- adjtime gss printcap
- aliases gssproxy profile
- aliases.db host.conf profile.d
- alsa hostname protocols
- alternatives hosts pulse
- anacrontab hosts.allow purple
- asound.conf hosts.deny python
- at.deny hp qemu-ga
- audisp httpd qemu-kvm
- audit idmapd.conf radvd.conf
- autofs.conf init.d rc0.d
- autofs_ldap_auth.conf inittab rc1.d
- auto.master inputrc rc2.d
- auto.master.d ipa rc3.d
- auto.misc iproute2 rc4.d
- auto.net ipsec.conf rc5.d
- auto.smb ipsec.d rc6.d
- avahi ipsec.secrets rc.d
- bash_completion.d iscsi rc.local
- bashrc issue rdma
- binfmt.d issue.net redhat-release
- bluetooth java request-key.conf
- brltty jvm request-key.d
- brltty.conf jvm-commmon resolv.conf
- centos-release kdump.conf rpc
- centos-release-upstream kernel rpm
- certmonger krb5.conf rsyncd.conf
- cgconfig.conf krb5.conf.d rsyslog.conf
- cgconfig.d ksmtuned.conf rsyslog.d
- cgrules.conf ld.so.cache rwtab
- cgsnapshot_blacklist.conf ld.so.conf rwtab.d
- chkconfig.d ld.so.conf.d samba
- chrony.conf libaudit.conf sane.d
- chrony.keys libblockdev sasl2
- cifs-utils libibverbs.d scl
- cron.d libnl securetty
- cron.daily libreport security
- cron.deny libuser.conf selinux
- cron.hourly libvirt services
- cron.monthly locale.conf sestatus.conf
- crontab localtime setroubleshoot
- cron.weekly login.defs setuptool.d
- crypttab logrotate.conf sgml
- csh.cshrc logrotate.d shadow
- csh.login lsm shadow-
- cups lvm shells
- cupshelpers machine-id skel
- dbus-1 magic smartmontools
- dconf mailcap smi.conf
- default mail.rc sos.conf
- depmod.d makedumpfile.conf.sample speech-dispatcher
- dhcp man_db.conf ssh
- DIR_COLORS maven ssl
- DIR_COLORS.256color mime.types sssd
- DIR_COLORS.lightbgcolor mke2fs.conf statetab
- dleyna-server-service.conf modprobe.d statetab.d
- dnsmasq.conf modules-load.d subgid
- dnsmasq.d motd subuid
- dracut.conf mtab sudo.conf
- dracut.conf.d mtools.conf sudoers
- drirc multipath sudoers.d
- e2fsck.conf my.cnf sudo-ldap.conf
- enscript.cfg my.cnf.d sysconfig
- environment nanorc sysctl.conf
- ethertypes netconfig sysctl.d
- exports NetworkManager systemd
- exports.d networks system-release
- favicon.png nfs.conf system-release-cpe
- fcoe nfsmount.conf target
- festival nsswitch.conf tcsd.conf
- filesystems nsswitch.conf.bak terminfo
- firefox ntp tmpfiles.d
- firewalld ntp.conf trusted-key.key
- flatpak numad.conf tuned
- fonts oddjob udev
- fprintd.conf oddjobd.conf udisks2
- fstab oddjobd.conf.d unbound
- fuse.conf openldap updatedb.conf
- gconf opt UPower
- gcrypt os-release usb_modeswitch.conf
- gdbinit PackageKit vconsole.conf
- gdbinit.d pam.d vimrc
- gdm passwd virc
- geoclue passwd- vmware-tools
- GeoIP.conf pbm2ppa.conf wgetrc
- GeoIP.conf.default pinforc wpa_supplicant
- ghostscript pkcs11 wvdial.conf
- gnupg pki X11
- GREP_COLORS plymouth xdg
- groff pm xinetd.d
- group pnm2ppa.conf xml
- group- polkit-1 yum
- grub2.cfg popt.d yum.conf
- grub.d postfix yum.repos.d
- gshadow ppp
- [root@centos7 user]# ls /etc/group
- /etc/group
- [root@centos7 user]# cat /etc/group
- root:x:0:
- bin:x:1:
- daemon:x:2:
- sys:x:3:
- adm:x:4:
- tty:x:5:
- disk:x:6:
- lp:x:7:
- mem:x:8:
- kmem:x:9:
- wheel:x:10:user
- cdrom:x:11:
- mail:x:12:postfix
- man:x:15:
- dialout:x:18:
- floppy:x:19:
- games:x:20:
- tape:x:30:
- video:x:39:
- ftp:x:50:
- lock:x:54:
- audio:x:63:
- nobody:x:99:
- users:x:100:
- utmp:x:22:
- utempter:x:35:
- ssh_keys:x:999:
- input:x:998:
- systemd-journal:x:190:
- systemd-network:x:192:
- dbus:x:81:
- polkitd:x:997:
- postdrop:x:90:
- postfix:x:89:
- sshd:x:74:
- tss:x:59:
- wireshark:x:996:
- cgred:x:995:
- printadmin:x:994:
- rpc:x:32:
- gluster:x:993:
- dip:x:40:
- libstoragemgmt:x:992:
- unbound:x:991:
- kvm:x:36:qemu
- qemu:x:107:
- usbmuxd:x:113:
- chrony:x:990:
- rtkit:x:172:
- radvd:x:75:
- ntp:x:38:
- colord:x:989:
- abrt:x:173:
- geoclue:x:988:
- saslauth:x:76:
- libvirt:x:987:
- pulse-access:x:986:
- pulse-rt:x:985:
- pulse:x:171:
- gdm:x:42:
- setroubleshoot:x:984:
- rpcuser:x:29:
- nfsnobody:x:65534:
- sssd:x:983:
- stapusr:x:156:
- stapsys:x:157:
- stapdev:x:158:
- gnome-initial-setup:x:982:
- avahi:x:70:
- slocate:x:21:
- tcpdump:x:72:
- user:x:1000:
- apache:x:48:
- uzivatele:x:1001:
- [root@centos7 user]# useradd -g "uzivatele" Adam Bednar
- 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@centos7 user]# useradd
- 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@centos7 user]# useradd -a -G "uzivatele" Adam Bednar
- useradd: invalid option -- 'a'
- 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@centos7 user]# members uzivatele
- bash: members: command not found...
- [root@centos7 user]# sudo apt-get install members
- sudo: apt-get: command not found
- [root@centos7 user]# groups
- root
- [root@centos7 user]# uzivatele
- bash: uzivatele: command not found...
- [root@centos7 user]# group uzivatele
- bash: group: command not found...
- [root@centos7 user]# getent
- getent: wrong number of arguments
- Try `getent --help' or `getent --usage' for more information.
- [root@centos7 user]# getent group uzivatele
- uzivatele:x:1001:
- [root@centos7 user]# grep uzivatele /etc/group
- uzivatele:x:1001:
- [root@centos7 user]# useradd -a -G uzivatele Adam Bednar
- useradd: invalid option -- 'a'
- 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@centos7 user]# useradd -a -G "uzivatele" "Adam Bednar"
- useradd: invalid option -- 'a'
- 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@centos7 user]# useradd -a -G "uzivatele" "Cyril Duda "
- useradd: invalid option -- 'a'
- 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@centos7 user]# grep uzivatele /etc/group
- uzivatele:x:1001:
- [root@centos7 user]# useradd -m -s /bin/bash -a "Adam Bednar" -G "uzivatele"
- useradd: invalid option -- 'a'
- 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@centos7 user]# sudo groupadd uzivatele1
- [root@centos7 user]# sudo useradd -a -G uzivatele1 "Adam Bednar"
- useradd: invalid option -- 'a'
- 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@centos7 user]# useradd -G "uzivatele" "Adam Bednar"
- useradd: invalid user name 'Adam Bednar'
- [root@centos7 user]# useradd -g "uzivatele" "Adam Bednar"
- useradd: invalid user name 'Adam Bednar'
- [root@centos7 user]# grep uzivatele /etc/group
- uzivatele:x:1001:
- uzivatele1:x:1002:
- [root@centos7 user]# sudo useradd -g "uzivatele" "Adam Bednar"
- useradd: invalid user name 'Adam Bednar'
- [root@centos7 user]# usermod
- Usage: usermod [options] LOGIN
- Options:
- -c, --comment COMMENT new value of the GECOS field
- -d, --home HOME_DIR new home directory for the user account
- -e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
- -f, --inactive INACTIVE set password inactive after expiration
- to INACTIVE
- -g, --gid GROUP force use GROUP as new primary group
- -G, --groups GROUPS new list of supplementary GROUPS
- -a, --append append the user to the supplemental GROUPS
- mentioned by the -G option without removing
- him/her from other groups
- -h, --help display this help message and exit
- -l, --login NEW_LOGIN new value of the login name
- -L, --lock lock the user account
- -m, --move-home move contents of the home directory to the
- new location (use only with -d)
- -o, --non-unique allow using duplicate (non-unique) UID
- -p, --password PASSWORD use encrypted password for the new password
- -R, --root CHROOT_DIR directory to chroot into
- -s, --shell SHELL new login shell for the user account
- -u, --uid UID new UID for the user account
- -U, --unlock unlock the user account
- -Z, --selinux-user SEUSER new SELinux user mapping for the user account
- [root@centos7 user]# sudo usermod -a -G uzivatele "Adam Bednar"
- usermod: user 'Adam Bednar' does not exist
- [root@centos7 user]# sudo usermod -a -G uzivatele Adam Bednar
- Usage: usermod [options] LOGIN
- Options:
- -c, --comment COMMENT new value of the GECOS field
- -d, --home HOME_DIR new home directory for the user account
- -e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
- -f, --inactive INACTIVE set password inactive after expiration
- to INACTIVE
- -g, --gid GROUP force use GROUP as new primary group
- -G, --groups GROUPS new list of supplementary GROUPS
- -a, --append append the user to the supplemental GROUPS
- mentioned by the -G option without removing
- him/her from other groups
- -h, --help display this help message and exit
- -l, --login NEW_LOGIN new value of the login name
- -L, --lock lock the user account
- -m, --move-home move contents of the home directory to the
- new location (use only with -d)
- -o, --non-unique allow using duplicate (non-unique) UID
- -p, --password PASSWORD use encrypted password for the new password
- -R, --root CHROOT_DIR directory to chroot into
- -s, --shell SHELL new login shell for the user account
- -u, --uid UID new UID for the user account
- -U, --unlock unlock the user account
- -Z, --selinux-user SEUSER new SELinux user mapping for the user account
- [root@centos7 user]# sudo usermod -a -G "uzivatele" "Adam Bednar"
- usermod: user 'Adam Bednar' does not exist
- [root@centos7 user]# sudo useradd -g "uzivatele" "Adam Bednar"
- useradd: invalid user name 'Adam Bednar'
- [root@centos7 user]# sudo useradd -g "uzivatele" "AdamBednar" adam.bednar
- 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@centos7 user]# sudo useradd -g "uzivatele" adam.bednar
- [root@centos7 user]# grep uzivatele /etc/group
- uzivatele:x:1001:
- uzivatele1:x:1002:
- [root@centos7 user]# ls /home
- adam.bednar user
- [root@centos7 user]# sudo useradd -g "uzivatele" bohumil.coufal
- [root@centos7 user]# sudo useradd -g "uzivatele" cyril.duda
- [root@centos7 user]# sudo useradd -g "uzivatele" david.egrt
- [root@centos7 user]# sudo useradd -g "uzivatele" eva.filova
- [root@centos7 user]# ls /home
- adam.bednar bohumil.coufal cyril.duda david.egrt eva.filova user
- [root@centos7 user]# grep uzivatele /etc/group
- uzivatele:x:1001:
- uzivatele1:x:1002:
- [root@centos7 user]# sudo useradd -g uzivatele eva.filova
- useradd: user 'eva.filova' already exists
- [root@centos7 user]# sudo usermod -a -G uzivatele adam.bednar
- [root@centos7 user]# grep uzivatele /etc/group
- uzivatele:x:1001:adam.bednar
- uzivatele1:x:1002:
- [root@centos7 user]# sudo usermod -a -G uzivatele bohumil.coufal
- [root@centos7 user]# sudo usermod -a -G uzivatele cyril.duda
- [root@centos7 user]# sudo usermod -a -G uzivatele david.egrt
- [root@centos7 user]# sudo usermod -a -G uzivatele eva.filova
- [root@centos7 user]# grep uzivatele /etc/group
- uzivatele:x:1001:adam.bednar,bohumil.coufal,cyril.duda,david.egrt,eva.filova
- uzivatele1:x:1002:
- [root@centos7 user]# sudo passwd adam.bednar
- Changing password for user adam.bednar.
- New password:
- BAD PASSWORD: The password is shorter than 8 characters
- Retype new password:
- Sorry, passwords do not match.
- New password:
- BAD PASSWORD: The password contains the user name in some form
- Retype new password:
- Sorry, passwords do not match.
- New password:
- [root@centos7 user]# sudo passwd adam.bednar
- Changing password for user adam.bednar.
- New password:
- BAD PASSWORD: The password is shorter than 8 characters
- Retype new password:
- passwd: all authentication tokens updated successfully.
- [root@centos7 user]# sudo chage --list adam.bednar
- Last password change : Feb 21, 2019
- Password expires : never
- Password inactive : never
- Account expires : never
- Minimum number of days between password change : 0
- Maximum number of days between password change : 99999
- Number of days of warning before password expires : 7
- [root@centos7 user]# sudo chage -d 0 adam.bednar
- [root@centos7 user]# sudo chage --list adam.bednar
- Last password change : password must be changed
- Password expires : password must be changed
- Password inactive : password must be changed
- Account expires : never
- Minimum number of days between password change : 0
- Maximum number of days between password change : 99999
- Number of days of warning before password expires : 7
- [root@centos7 user]# su adam.bednar
- [adam.bednar@centos7 user]$ dsds
- bash: dsds: command not found...
- [adam.bednar@centos7 user]$ sudo
- usage: sudo -h | -K | -k | -V
- usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
- usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user] [command]
- usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt] [-u
- user] [VAR=value] [-i|-s] [<command>]
- usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt] [-u
- user] file ...
- [adam.bednar@centos7 user]$ su root
- Password:
- su: Authentication failure
- [adam.bednar@centos7 user]$ sudo passwd adam.bednar
- We trust you have received the usual lecture from the local System
- Administrator. It usually boils down to these three things:
- #1) Respect the privacy of others.
- #2) Think before you type.
- #3) With great power comes great responsibility.
- [sudo] password for adam.bednar:
- sudo: Account or password is expired, reset your password and try again
- Changing password for adam.bednar.
- (current) UNIX password:
- New password:
- BAD PASSWORD: The password is too similar to the old one
- New password:
- BAD PASSWORD: The password is too similar to the old one
- New password:
- Retype new password:
- adam.bednar is not in the sudoers file. This incident will be reported.
- [adam.bednar@centos7 user]$ su sudo
- su: user sudo does not exist
- [adam.bednar@centos7 user]$ su root
- Password:
- su: Authentication failure
- [adam.bednar@centos7 user]$ grep uzivatele /etc/group
- uzivatele:x:1001:adam.bednar,bohumil.coufal,cyril.duda,david.egrt,eva.filova
- uzivatele1:x:1002:
- [adam.bednar@centos7 user]$ sudo passwd adam.bednar
- [sudo] password for adam.bednar:
- adam.bednar is not in the sudoers file. This incident will be reported.
- [adam.bednar@centos7 user]$ su user
- Password:
- [user@centos7 ~]$ sudo -s
- [sudo] password for user:
- [root@centos7 user]# sudo passwd adam.bednar
- Changing password for user adam.bednar.
- New password:
- BAD PASSWORD: The password contains the user name in some form
- Retype new password:
- passwd: all authentication tokens updated successfully.
- [root@centos7 user]# sudo chage --list adam.bednar
- Last password change : Feb 21, 2019
- Password expires : never
- Password inactive : never
- Account expires : never
- Minimum number of days between password change : 0
- Maximum number of days between password change : 99999
- Number of days of warning before password expires : 7
- [root@centos7 user]# sudo chage -d 0 adam.bednar
- [root@centos7 user]# sudo chage --list adam.bednar
- Last password change : password must be changed
- Password expires : password must be changed
- Password inactive : password must be changed
- Account expires : never
- Minimum number of days between password change : 0
- Maximum number of days between password change : 99999
- Number of days of warning before password expires : 7
- [root@centos7 user]# su adam.bednar
- [adam.bednar@centos7 user]$ su user
- Password:
- [user@centos7 ~]$ sudo -s
- [root@centos7 user]# sudo mkdir /home/adam.bednar/groupshare
- [root@centos7 user]# sudo mkdir /home/home
- [root@centos7 user]# ls /home
- adam.bednar bohumil.coufal cyril.duda david.egrt eva.filova home user
- [root@centos7 user]# ls /home/home
- [root@centos7 user]# ls /adam.bednar
- ls: cannot access /adam.bednar: No such file or directory
- [root@centos7 user]# ls adam.bednar
- ls: cannot access adam.bednar: No such file or directory
- [root@centos7 user]# sudo mkdir groupshare
- [root@centos7 user]# ls /home
- adam.bednar bohumil.coufal cyril.duda david.egrt eva.filova home user
- [root@centos7 user]# cd /home
- [root@centos7 home]# sudo mkdir groupshare
- [root@centos7 home]# ls /home
- adam.bednar bohumil.coufal cyril.duda david.egrt eva.filova groupshare home user
- [root@centos7 home]# man chmod
- [root@centos7 home]# chmod 770 groupshare
- [root@centos7 home]# sudo chmod 770 groupshare
- [root@centos7 home]# sudo mkdir publicshare
- [root@centos7 home]# sudo chmod 777 publicshare
- [root@centos7 home]# sudo chown user publicshare
- [root@centos7 home]# sudo useradd -m adam.bednar
- useradd: user 'adam.bednar' already exists
- [root@centos7 home]# usermod
- Usage: usermod [options] LOGIN
- Options:
- -c, --comment COMMENT new value of the GECOS field
- -d, --home HOME_DIR new home directory for the user account
- -e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
- -f, --inactive INACTIVE set password inactive after expiration
- to INACTIVE
- -g, --gid GROUP force use GROUP as new primary group
- -G, --groups GROUPS new list of supplementary GROUPS
- -a, --append append the user to the supplemental GROUPS
- mentioned by the -G option without removing
- him/her from other groups
- -h, --help display this help message and exit
- -l, --login NEW_LOGIN new value of the login name
- -L, --lock lock the user account
- -m, --move-home move contents of the home directory to the
- new location (use only with -d)
- -o, --non-unique allow using duplicate (non-unique) UID
- -p, --password PASSWORD use encrypted password for the new password
- -R, --root CHROOT_DIR directory to chroot into
- -s, --shell SHELL new login shell for the user account
- -u, --uid UID new UID for the user account
- -U, --unlock unlock the user account
- -Z, --selinux-user SEUSER new SELinux user mapping for the user account
- [root@centos7 home]# sudo mkdir adam.bednar
- mkdir: cannot create directory ‘adam.bednar’: File exists
- [root@centos7 home]# sudo mkdir adam.bednar/readonlz
- [root@centos7 home]# sudo mkdir adam.bednar/readonly
- [root@centos7 home]# ls .
- adam.bednar cyril.duda eva.filova home user
- bohumil.coufal david.egrt groupshare publicshare
- [root@centos7 home]# ls ./adam.bednar
- groupshare readonly readonlz
- [root@centos7 home]# sudo chmod 3444 ./adam.bednar/readonly
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement