| Linux | Security | Debian | Slax | Tiny Core | Health |
|
If a Computer Won't Start from a CD, DVD or USB Drive List the Contents of a Directory Mount an ISO Image Without Writing it to a CD or DVD |
LinuxFile PermissionsFile OwnershipWhen using a Linux filesystem, every file and directory belongs to an Owner and Group. Owner, Group and OthersEvery file and directory has three sets of permissions, for the owner, group and others. Read, Write and ExecutePermissions include read, write and execute, or no permission. FilesIf you have permission to read a file, you can read it, but not modify it. If you have permission to write, you can modify it. If you have permission to execute, you can execute it. This normally applies to program files. If you don't have any permissions, you cannot even read the file. DirectoriesIf you have permission to read a directory, you can use a command such as ls to list the files in that directory. If you have permission to write to a directory, you can create, delete or rename files or subdirectories in that directory. If you have permission to execute a directory, you can use the cd command to go to that directory and make it the working directory. SecurityHaving File Ownership and permissions, increases the security of Linux operating systems. Files cannot be modified without appropriate permissions. Unauthorized access is more difficult. Linux is less likely to be affected by viruses and malware. When malware does affect Linux, it is less invasive. Root File ManagerWith most Linux distributions, permissions can be changed using the Root File Manager. To do this, right click on a file or directory. Click "Properties," then click "Permissions." Root TerminalFollowing is how to change permissions using the Root Terminal. Find Out PermissionsTo find out permissions, open the terminal and type:
ls stands for list, and -l stands for long. You will see something like:
The first letter shows the type of file. The next three letters show permissions for the owner. The three after that show the permissions for the group. The last three show the permissions for others. The first letter may be: - file d directory l link The following letters may be: - no permission r read w write x execute Changing Permissions Using the Numeric ModeThere are different ways to change permissions. One way is using the numeric mode. The following numbers are used. 0 no permission 4 read 2 write 1 execute Add numbers together. For example, for read and write use 6 (4+2), for read and execute use 5 (4+1), and for read, write and execute, use 7 (4+2+1). Permissions go in the order owner, group and others. For example 640 means, read and write for the owner, read for the group, and no permission for others. To change permissions, open the Root Terminal and type:
chmod stands for change mode. The options within square brackets are optional. You must always include "chmod," the numeric mode numbers, and the name of the file. For example, to change the permissions of anyfile.txt, to read, write and execute for the owner, and read and execute for the group and others, use:
The Recursive OptionThe recursive option enables you to change the permissions of a directory, and all files and directories within that directory, with one command. To do this use "-R." For example, if you wanted to change the permissions of the directory mydirectory, and all files and directories within mydirectory, to 755, you could use:
Changing Permissions Using the Symbolic ModeWhen changing permissions using the symbolic mode, you specify who to change the permissions for. This may be: u user g group o others a all These may be combined. You may have: ug user and group uo user and others go group and others ugo all - the same as a If not specified, permissions are changed for all. Permissions may be: + added - removed = changed to the permissions specified Permissions may be: r read w write x execute Following are examples. To add read for user and group, use:
To remove execute for all, use:
To make permissions read and write for all, use:
The recursive option may also be used. To add read permission for the user for all files and subdirectories in a directory, use:
Set User IDPermissions are normally r, w or x. In some situations, the x may be replaced by an s. This enables the user to have the permissions of the owner or group of the file, just for that process. This may be used, for example, to enable users to change their passwords. You normally need to be root to change passwords. s may be used to enable users to have root permissions just while changing their password. More InformationFor more information and other options, open the terminal and type:
for the manual, or
for help. © Copyright Guy Shipard 2008 - 2009 |
||||||||||||||||||||||||||||||||||||||||