FILE TYPES-PERMISSIONS-SYMLINKS
Features:
1. The ability to restrict/control access to files
Note:
• 10 bits represent permissions for files (including directories)
• use 'ls -l' to examine permissions or GUI application like 'Nautilus'
-rwxrwxr-x 1 linuxcbt linuxcbt 681 Jan 13 11:31 regextest.pl
• 1st bit = file type. '-' = file, 'd' = directory
• 2nd - 4th bits = owner's permissions
• r = read = 4
• w = write = 2
• x = execute = 1
• -= none = 0
• 5th - 7th bits = group owner's permissions
• r = read = 4
• w = write = 2
• x = execute = 1
• -= none = 0
• 8th - 10th bits = everyone (world)
• r = read = 4
• w = write = 2
• x = execute = 1
• -= none = 0
Task:
1. Manipulate file permissions using 'chmod'
• chmod -x regextest.pl
• -rw-rw-r-- 1 linuxcbt linuxcbt 681 Jan 13 11:31 regextest.pl
• rw = 6 or 4+2 for owner
• rw = 6 or 4+2 for group owner
• r = 4 for everyone else (world)
• Octal notation: 664 for file 'regexetest.pl'
• chmod 664 regextest.pl - removes execution for ALL users
• chmod 775 regextest.pl - enables execution for ALL users
2. Ensure that 'regextest.pl' is rw by owner and noone else
• chmod 600 regextest.pl
Note: File will now be rw by owner (linuxcbt) and 'root'
3. Ensure that 'regextest.pl' is r by owner and noone else
• chmod 400 regextest.pl && ls -l regextest.pl
Note: chmod supports string values, which represent octal values
• chmod +/- x file
• chmod +/- w file
• chmod +/- r file
• chmod +/- u+x file - updates owner's execute permissions on the file
• chmod +/- o+x file - updates other's execute permissions on the file
• chmod +/- g+x file - updates group's execute permissions on the file
• chmod a+rwx = chmod 777
• chown - permits changing of ownership of files
chown root regextest.pl - changes ownership to 'root'
chown linuxcbt:sales regextest.pl - changes owner and group to
'linuxcbt:sales'
Task:
Update 'regextest.pl' so that owner and group owner may modify the file
• chmod 660 regextest.pl
No comments:
Post a Comment