Fedora 29
Sponsored Link

Initial Settings : Add User Accounts2018/10/31

[1] If you'd like to add common user accounts on Fedora Server, Configure like follows.
[root@localhost ~]#
useradd fedora

[root@localhost ~]#
passwd fedora

Changing password for user fedora.
New UNIX password:              # set password
Retype new UNIX password:       # confirm
passwd: all authentication tokens updated successfully.
[2] If you'd like to switch to root account from a user added above, use [su] command to do so.
localhost login: fedora         # input user name
password:                       # input password
[fedora@localhost ~]$
su -
# switch to root

Password:                       # root password
[root@localhost ~]#             # just switched to root account
[3] Make a user (it's [fedora] in this example) be only a user who can switch to root as an administration user.
[root@localhost ~]#
usermod -G wheel fedora

[root@localhost ~]#
vi /etc/pam.d/su
auth            sufficient      pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth           sufficient      pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
# uncomment the following line
auth            required        pam_wheel.so use_uid
auth            substack        system-auth
auth            include         postlogin
account         sufficient      pam_succeed_if.so uid = 0 use_uid quiet
account         include         system-auth
password        include         system-auth
session         include         system-auth
session         include         postlogin
session         optional        pam_xauth.so
[4] If you'd like to remove a user accounts, Configure like follows.
# remove a user [fedora] (only removed user account)

[root@localhost ~]#
userdel fedora
# remove a user [fedora] (removed user account and his home directory)

[root@localhost ~]#
userdel -r fedora
Matched Content