If you can see this check that
next section | up | prev page | next page |
Access to Unix files are governed by ownership and permissions. If you create a file, you are automatically the owner of that file, and can set the permissions for that file to give or deny access to other users of the system.
There are three different levels of permission:
File permissions can be set for three different levels of ownership:
Thus you can set read, write, and execute permissions for the three classes of ownership:
-rxwrwxrwx. | \ \ \___________ | \ \__ \ | | \ \ owner group other alternative access method indicator
For example, to see the permissions, owner name, and group name on 'myfile' type the following:
% ls -l myfile -rwxrw-r--. 1 john staff 567 Nov 18 12:26 myfile | | | | | | | (permissions) (links) (owner) (group) (bytes) (date) (filename)
The first dash on the left indicates the type of data that this entry represents. In this case 'myfile' is described as a simple file since the leading character is a '-' (if 'myfile' was a directory you would see a 'd' rather than a '-'). The next nine positions indicate read, write, and execute permissions for owner, group, and other. If a permission is not allowed, a '-' appears in the place of the letter.
In the example (-rwxrw-r--), owner (john) has read, write, and execute permissions (rwx); the group (staff) has read and write permissions (rw-); while other has only read permission (r--).
The trailing "." after the permissions in the example "-rwxrw-r--." indicates that an alternative access method exists. This character can be
> touch test > setfacl .m user:root:rwx test > ls -l test -rw-rw-r--+ 1 gordon gordon 0 Aug 30 15:25 test > getfacl test user::rw- user:root:rwx group::rw- mask::rw- other::r--
Here the file "test" has been given an additional File Access Control List which gives the user "root" "rwx" access to the file. This additional access method is flagged up with a "+" in the "ls" command.
Another access method which is common in Linux flavours like RedHat and Fedora is SELinux. This secures processes by restricting what they can do using pre-defined rules. For instance, the web server is configured in Fedora to only publish files to the web which are in the context "httpd_user_context_t". You can see the context using "-Z" in the "ls" command:
touch test > ls -Z test -rw-rw-r--. gordon users unconfined_u:object_r:httpd_user_content_t:s0 test
Additional access methods is a complex subject in itself, and will be discussed later on in the material. For now, just ignore the trailing "." in the permissions.
% ls -l myfile -rwxrw-r--. 1 john staff 567 Nov 18 12:26 myfile | | | | | | | (permissions) (links) (owner) (group) (bytes) (date) (filename)
As the leading character in the example was a "-" this indicates that "myfile" is a simple file. Some possibilities include:
Centos 7 intro: | Paths | BasicShell | Search |
Linux tutorials: | intro1 intro2 wildcard permission pipe vi essential admin net SELinux1 SELinux2 fwall DNS diag Apache1 Apache2 log Mail |
Caine 10.0: | Essentials | Basic | Search | Acquisition | SysIntro | grep | MBR | GPT | FAT | NTFS | FRMeta | FRTools | Browser | Mock Exam | |
Caine 13.0: | Essentials | Basic | Search | |
CPD: | Cygwin | Paths | Files and head/tail | Find and regex | Sort | Log Analysis |
Kali: | 1a | 1b | 1c | 2 | 3 | 4a | 4b | 5 | 6 | 7a | 8a | 8b | 9 | 10 | |
Kali 2020-4: | 1a | 1b | 1c | 2 | 3 | 4a | 4b | 5 | 6 | 7 | 8a | 8b | 9 | 10 | |
Useful: | Quiz | Forums | Privacy Policy | Terms and Conditions |
Linuxzoo created by Gordon Russell.
@ Copyright 2004-2024 Edinburgh Napier University