Panduan cara menciptakan user gres di Linux, baris perintah ini sanggup dipakai pada operasi sistem Linux Ubuntu, Debian, Centos, Fedora, SUSE dan semua Linux varian apapun, FreeBSD serta Unix-like operating systems.
Sebagai rujukan disini akan menambahkan user lina dan mia
Membuat user baru
Gunakan akun superuser (root) untuk memanajemen akun user di Linux. Ada dua perintah yang sanggup dipakai untuk menciptakan user gres melalui command-line, yaitu useradd dan adduser, pada kesempatan ini useradd ialah cara yang saya pilih.
useradd -m lina
-m untuk menciptakan direktori default pada /home/lina untuk user lina.
* Catatan: Default direktori user berada di /home
Dengan perintah tersebut, user lina sudah berhasil dibuat, langkah selanjutnya ialah mengatur password (kata sandi) untuk user lina.
passwd lina
Hasilnya
Enter new UNIX password:
Retype new UNIX password:
Kemudian masukkan password untuk user lina.
Tambah user gres lainya, contohnya mia
useradd -m mia
passwd mia
Jika menginginkan direktori yang berbeda tambahkan opsi -d
useradd mia -d /var/www/html
Atau menciptakan user tanpa direktori dengan opsi -M
useradd -M mia
Catatan:
- Gunakan perintah
usermoduntuk mengganti home directory user, contoh:usermod -d /direktori/baru mia
Melihat warta user, dengan perintah berikut
cat /etc/passwd | grep mia
Hasilnya
mia:x:5001:5001::/home/mia:
Menambahkan user tanpa jalan masuk login shell
useradd -s /sbin/nologin mia
Menghapus user
userdel mia
Menghapus user sekaligus home directory dan mail spool directory
userdel -r mia
Menambahkan user ke group sudo
Untuk Debian/Ubuntu
usermod -aG sudo miauntuk CentOS
usermod -aG wheel miaOpsi lainya sanggup dilihat melalui
useradd -help
Hasilnya
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
--extrausers Use the extra users database
Cara login user lain (beralih) dalam satu terminal.
su - mia
su artinya swith user
Cara keluar
exit
Selamat mencoba kawan.
Sumber https://idnetter.com
Mari berteman dengan saya
Follow my Instagram _yudha58
0 Response to "Cara Menciptakan User Gres Di Linux"
Posting Komentar