manajemen user & group · /etc/passwd. # cat /etc/passwd. manajemen group group yang terdaftar...

23
Manajemen User & Group oleh Walid Umar, S.SI @walidumar

Upload: phamliem

Post on 08-Mar-2019

257 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

Manajemen User & Group

oleh Walid Umar, S.SI@walidumar

Page 2: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

Manajemen User (1)

Linux mengatur manajemen user kedalam dua golongan yaitu : (1) superuser; (2) user biasa.

➔ Superuser memiliki wewenang penuh dalam sistem.

➔ Masing-masing user memiliki home direktori (lingkup kerja)

➔ Dalam sebuah sistem linux hanya memiliki 1 superuser, sebaliknya dengan user biasa.

Page 3: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

Manajemen User (2)

User yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/passwd.

# cat /etc/passwd

Page 4: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

Manajemen group

Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group.

# cat /etc/group

Page 5: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

Manajemen User (3)

Perintah untuk membuat user :# adduser [nama_user]# useradd [nama_user]

Perintah untuk menghapus user : # deluser [nama_user]# userdel [nama_user]

Page 6: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

adduser - add a user or group to the system

Page 7: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

groupadd – create a group in system

root@saronde:~# groupadd grouptkj

root@saronde:~# cat /etc/group.............ftp:x:1002:ntop:x:134:gammu:x:140:informatika:x:1003:tkj:x:1005:

Page 8: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

useradd – create a user in system

root@saronde:~# cat /etc/passwd.............informatika:x:1001:1001::/home/informatika:/bin/bashtkj:x:1002:1001::/home/tkj:/bin/sh

Page 9: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

passwd - change user password

Merubah password :

root@saronde:~# passwd tkjEnter new UNIX password: Retype new UNIX password: passwd: password updated successfully

Page 10: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

login – log in system

root@saronde:~# loginsaronde login: informatikaPassword:

Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic-pae i686) * Documentation: https://help.ubuntu.com/.......................informatika@saronde:~$ whoamiInformatika

Page 11: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

su - change user ID or become superuser

root@saronde:~# su tkj$ whoamiTkj

Page 12: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

usermod – modify user account

informatika@saronde:~$ usermod --helpUsage: 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 -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 new SELinux user mapping for the user account

Page 13: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

usermod – modify user account

Memindahkan user ke group : saronde_os@saronde:~$ sudo usermod -G [group] [user]

Lock sebuah user :saronde_os@saronde:~$ sudo usermod -L [user]

Unlock sebuah user :saronde_os@saronde:~$ sudo usermod -U [user]

Page 14: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

chown - change file owner and group

saronde_os@saronde:~$ ls -l file_saronde -rw-r--r-- 1 saronde_os saronde_os 0 Okt 22 22:00 file_sarondesaronde_os@saronde:~$ sudo chown informatika file_saronde[sudo] password for saronde_os: saronde_os@saronde:~$ ls -l file_saronde -rw-r--r-- 1 informatika saronde_os 0 Okt 22 22:00 file_saronde

Page 15: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

chgrp - change group ownership

saronde_os@saronde:~$ sudo chgrp saronde_os file_saronde saronde_os@saronde:~$ ls -l file_saronde -rw-r--r-- 1 informatika saronde_os 0 Okt 22 22:00 file_saronde

Page 16: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

userdel - delete a user account and related files

saronde_os@saronde:~$ sudo deluser informatikaRemoving user `informatika' ...Warning: group `informatika' has no more members.Done.

saronde_os@saronde:~$ sudo userdel tkjRemoving user `tkj' ...Warning: group `tkj' has no more members.Done.

Page 17: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

groupdel - delete a group and related files

saronde_os@saronde:~$ sudo delgroup tkjRemoving group `tkj' ...Done.

saronde_os@saronde:~$ sudo groupdel tkj

Page 18: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

Latihan (1)

Buatlah 4 user : 1. rena2. rona3. rina4. reno

Buatlah 2 group : 1. siswa2. mahasiswa

Page 19: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

Latihan (2)

Kelompokkan user kedalam group :

1. siswa (rena, reno)2. mahasiswa (rona, rina)

Page 20: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

Latihan (3)

Buatlah file dengan nama : (1) ini_file_rena(2) ini_file_rona(3) ini_file_rina(4) ini_file_reno

Lakukan perubahan kepemilikan file diatas agar menjadi milik dari masing-masing user, dan menggunakan group sesuai dengan yang ditentukkan pada latihan (2)

Page 21: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

Latihan (4)

Lakukan perubahan permission terhadap file berikutDengan aturan sebagai berikut :

(1) ini_file_rena (r-- . r-x . --x)(2) ini_file_rona (rwx. --x . --x)(3) ini_file_rina (--- . --- . rwx)(4) ini_file_reno (--- . r-- . --x)

Lakukan pengujian terhadap keseluruhan file diatas.

Page 22: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

Latihan (5)

Jelaskan fungsi dan kegunaan beberapa perintah CLI berikut : ➔ ln, file, grep, locate, which, cat, ps, jobs,

Jelaskan fungsi simbolisasi dalam CLI berikut : ➔ >, <, | , &&

Buatlah keseluruhan latihan (5), dalam file word yang dikerjakan dikomputer masing-masing mahasiswa, keseluruhan perintah dijelaskan secara singkat kedalam file tersebut, beserta capture tampilan dalam penggunaan perintah.

Page 23: Manajemen User & Group · /etc/passwd. # cat /etc/passwd. Manajemen group Group yang terdaftar dalam sistem linux tersimpan dalam sebuah file yang terletak pada direktori /etc/group

Terimakasih

Walid Umar, [email protected]

http://walidumar.wordpress.com@walidumar