CentOS7 : Membuat User Baru di Centos7 - Rumahit.ID - Rumah Teknologi Informasi | Source Code Gratis

Baru

recent

CentOS7 : Membuat User Baru di Centos7

CentOS7 : Membuat User Baru di Centos7

Hallo, pada tutorial CentOS Series kali ini akan membahas mengenai user management. Yaitu menambah, mengedit dan menghapus user pada CentOS7.

1. Menambah User baru, contoh user centos

[root@dlp ~]# useradd centos 
[root@dlp ~]# passwd centos 
Changing password for user centos.
New UNIX password:                  # set password
Retype new UNIX password:           # confirm
passwd: all authentication tokens updated successfully.
[root@dlp ~]# exit                  # logout

2. Berganti User yang baru ditambahkan

dlp login: centos                 # input user name
password:                         # password
[centos@dlp ~]$ su -              # switch to root
Password:                         # root password
[root@dlp ~]#                     # just switched to root

3. Menjadikan hanya pengguna itu yang bisa mengakses root dan menjadi administrator

[root@dlp ~]# usermod -G wheel centos 
[root@dlp ~]# 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

4. Mengubah nama user

Perintah :
killall -u old
id old
usermod -l new old
groupmod -n new old
usermod -d /home/new -m new
usermod -c “New Real Name” new
id new

kill -u centos
#id centos
uid=1000(centos) gid=1000(centos) groups=1000(centos),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),109(lpadmin),127(sambashare)
# id vanessa
uid=1001(vanessa) gid=1001(vanessa) groups=1001(vanessa)
centos@centos ~ $
usermod -l  vanessa centos
groupmod -n vanessa centos
usermod -d /home/vanessa -m  vanessa
usermod -c "Vanessa Angel" vanessa
id vanessa 

5. Menghapus nama pengguna

userdel -r username 

Powered By Blogger

Contact Form

Name

Email *

Message *

Powered by Blogger.