Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Module Linux essentials - Module 15 introduce ownership and permissions in Linux. This module include content: Ownership, identity information, changing file and group ownership, permissions, chmod command, umask command. | Module 15 Ownership and Permissions Exam Objective 5.3 Managing File Permissions and Ownership Objective Summary File and directory permissions and owners Ownership Viewing Ownership (ls -l) To view the ownerships of a regular file, you can use the ls –l command: [sysadmin@localhost ~]$ ls -l /etc/named.conf -rw-r-----. 1 root named 1163 May 13 10:27 /etc/named.conf To view the ownerships of a directory file, you can use the ls -ld command: [sysadmin@localhost ~]$ ls -ld /etc/named drwxr-x---. 2 root named 4096 Mar 28 2013 /etc/named user owner group owner user owner group owner Viewing Ownership (stat) Another command that allows you to view ownership information in a more detailed way is the stat command: [sysadmin@localhost ~]$ stat /etc/named File: `/etc/named' Size: 4096 Blocks: 8 IO Block: 4096 directory Device: fd00h/64768d Inode: 153995 Links: 2 Access: (0750/drwxr-x---) Uid: ( 0/ root) Gid: ( 25/ named) Access: 2013-10-28 16:21:34.949997291 -0700 Modify: 2013-03-28 15:18:54.000000000 -0700 Change: 2013-05-13 09:56:53.831158705 -0700 user owner group owner File Ownership Every file is owned by a user and a group. If a user creates a file, they will be the user owner of that file. The chown command can change user ownership of a file, but it can only be used by the root user. Although most commands will show the user's account name as the owner, the operating system is actually associating that user’s UID as the file owner. Group Ownership When a file is created, the user's primary group is the group owner of the file. The user can use the chgrp command to change the group owner of a file the user owns, to a group that the user is a member. The root user can use the chgrp command to change the group owner of any file to any group. While most commands will show a group name as the group owner, the system actually tracks group ownership by the GID of the group. Orphaned Files If a user is deleted, or has their UID changed, their former UID will show as the . | Module 15 Ownership and Permissions Exam Objective 5.3 Managing File Permissions and Ownership Objective Summary File and directory permissions and owners Ownership Viewing Ownership (ls -l) To view the ownerships of a regular file, you can use the ls –l command: [sysadmin@localhost ~]$ ls -l /etc/named.conf -rw-r-----. 1 root named 1163 May 13 10:27 /etc/named.conf To view the ownerships of a directory file, you can use the ls -ld command: [sysadmin@localhost ~]$ ls -ld /etc/named drwxr-x---. 2 root named 4096 Mar 28 2013 /etc/named user owner group owner user owner group owner Viewing Ownership (stat) Another command that allows you to view ownership information in a more detailed way is the stat command: [sysadmin@localhost ~]$ stat /etc/named File: `/etc/named' Size: 4096 Blocks: 8 IO Block: 4096 directory Device: fd00h/64768d Inode: 153995 Links: 2 Access: (0750/drwxr-x---) Uid: ( 0/ root) Gid: ( 25/ named) Access: 2013-10-28 16:21:34.949997291 -0700 Modify: 2013-03-28 .