Thử thêm cái coi lào
Feb
14
Cấu hình thêm một username và group cho Linux
hrockvn , 13:45 , Networking , Nhận xét: (0) , Trích dẫn: (0) , Đọc: (961) , Via Tự viết
Lớn | Vừa | Nhỏ
Lớn | Vừa | Nhỏ
Để thay đổi quyền từ user bình thường sang Super user là root ta dùng command “su”
Command cho phép tạo các nhóm trong Linux
[root@vnnetsoft.com]# groupadd parents
[root@vnnetsoft.com]# groupadd children
[root@vnnetsoft.com]# groupadd soho
Command cho phép ta gán user vào một nhóm người sử dụng:
[root@vnnetsoft.com]# useradd -g parents paul
[root@vnnetsoft.com]# useradd -g parents jane
[root@vnnetsoft.com]# useradd -g children derek
[root@vnnetsoft.com]# useradd -g children alice
[root@vnnetsoft.com]# useradd -g soho accounts
[root@vnnetsoft.com]# useradd -g soho sales
Command cho phép hiển thị user và nhóm trong thư mục home :
[root@vnnetsoft.com]# ll /home
[root@vnnetsoft.com]#
Khi đã tạo ra một user thì ta phải thiết lập pass cho user đó bằng command sau :
[root@vnnetsoft.com]# passwd paul
Để xóa một user và các profiles có liên quan ta dùng command sau :
[root@vnnetsoft.com]# userdel paul
[root@vnnetsoft.com]# userdel -r paul
Để biết thông tin user thuộc nhóm nào ta có thể dùng command sau :
[root@vnnetsoft.com]# groups paul
paul : parents
[root@vnnetsoft.com]#
Khi thiết lập quyền cho từng user quản lý files hay thư mục của họ ta dùng command sau :
[root@vnnetsoft.com]# ll test.txt
-rw-r--r-- 1 root root 0 Nov 17 22:14 test.txt
[root@vnnetsoft.com]# chown users:groups test.txt
[root@vnnetsoft.com]# ll test.txt
-rw-r--r-- 1 testuser users 0 Nov 17 22:14 test.txt
Command cho phép tạo các nhóm trong Linux
[root@vnnetsoft.com]# groupadd parents
[root@vnnetsoft.com]# groupadd children
[root@vnnetsoft.com]# groupadd soho
Command cho phép ta gán user vào một nhóm người sử dụng:
[root@vnnetsoft.com]# useradd -g parents paul
[root@vnnetsoft.com]# useradd -g parents jane
[root@vnnetsoft.com]# useradd -g children derek
[root@vnnetsoft.com]# useradd -g children alice
[root@vnnetsoft.com]# useradd -g soho accounts
[root@vnnetsoft.com]# useradd -g soho sales
Command cho phép hiển thị user và nhóm trong thư mục home :
[root@vnnetsoft.com]# ll /home
Trích:
| drwxr-xr-x 2 root root 12288 Jul 24 20:04 lost+found drwx------ 2 accounts soho 1024 Jul 24 20:33 accounts drwx------ 2 alice children 1024 Jul 24 20:33 alice drwx------ 2 derek children 1024 Jul 24 20:33 derek drwx------ 2 jane parents 1024 Jul 24 20:33 jane drwx------ 2 paul parents 1024 Jul 24 20:33 paul drwx------ 2 sales soho 1024 Jul 24 20:33 sales |
Khi đã tạo ra một user thì ta phải thiết lập pass cho user đó bằng command sau :
[root@vnnetsoft.com]# passwd paul
Trích:
| Changing password for user paul. New password: Retype new password: passwd: all authentication tokens updated successfully. |
[root@vnnetsoft.com]# userdel paul
[root@vnnetsoft.com]# userdel -r paul
Để biết thông tin user thuộc nhóm nào ta có thể dùng command sau :
[root@vnnetsoft.com]# groups paul
paul : parents
[root@vnnetsoft.com]#
Khi thiết lập quyền cho từng user quản lý files hay thư mục của họ ta dùng command sau :
[root@vnnetsoft.com]# ll test.txt
-rw-r--r-- 1 root root 0 Nov 17 22:14 test.txt
[root@vnnetsoft.com]# chown users:groups test.txt
[root@vnnetsoft.com]# ll test.txt
-rw-r--r-- 1 testuser users 0 Nov 17 22:14 test.txt
Các lệnh căn bản về Network trong linux
Cấu hình SSH và Files Copying
