Để thêm tài khoản người dùng trên Máy chủ Fedora, hãy định cấu hình như sau. | |
[1] | Ví dụ: Thêm người dùng [fedora]. |
[root@localhost ~]# useradd fedora [root@localhost ~]# passwd fedora Changing password for user fedora. New UNIX password: # input any password you'd like to set Retype new UNIX password: # confirm passwd: all authentication tokens updated successfully. |
[2] | Nếu bạn muốn chuyển sang tài khoản root từ người dùng đã thêm ở trên, hãy sử dụng lệnh [su] làm như vậy. |
localhost login: fedora # login username password: # input user password[fedora@localhost ~]$ su - # switch to root Password: # input root password [root@localhost ~]# # just switched to root |
[3] | Nếu bạn muốn giới hạn người dùng chạy lệnh [su], hãy định cấu hình như sau. Trong ví dụ bên dưới, chỉ người dùng trong nhóm [wheel] mới có thể chạy lệnh [su]. |
[root@localhost ~]# usermod -aG wheel fedora
[root@localhost ~]#
vi /etc/pam.d/su #%PAM-1.0 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 # verify settings with a user that is not in allowed group [redhat@localhost ~]$ su -
Password:
su: Permission denied # denied normally
|
[4] | Nếu bạn muốn xóa tài khoản người dùng, hãy Đặt lượt thích như sau. |
# remove a user [fedora] (only removed user account) [root@localhost ~]# userdel fedora
# remove a user [fedora] (removed user account and his home directory both) [root@localhost ~]# userdel -r fedora
|