Spring Into Linux
|
You can change the permissions for a file using the Properties screen shown in Figure 9-2. To open the permission screen, right-click the file to be changed and select Properties. Then, click the Permissions tab. Figure 9-2. File information.
The screen shows the permissions for each of the three types of accounts. If you click the button for a particular account type, you see three choices: Forbidden, Can Read, and Can Read & Write. If you want to give execute permission to the file, check the Execute box. When the settings are right, click OK. On the command line, the chmod command is used to change the permissions. The format is one of the following: chmod accounttypes+permissions filename chmod accounttypes-permissions filename chmod accounttypes=permissions filename The three account types are indicated by letters: u for user (owner), g for group, o for others, and a for all account types. The three permissions are r, w, and x, as discussed previously. The three symbols that assign permissions are + (plus) to add permissions, - (minus) to remove permissions, and = (equal sign) to set new permissions. Thus, one command might be: chmod g+w file1 The command gives write permission to the group for a file named file1. It doesn't change any other permissions for the file. If the group already had read permission, it still has read permission. Another command might be: chmod g-w file1 The command removes write permission to the group for the file without changing any other permissions for the file. Another command might be: chmod go=x file1 The command gives execute permission to group and all accounts on the file. Group and all other accounts are not given read or write permissions. Because u was not specified in this command, the permissions for the owner are not changed. You can set all permissions at once using: chmod a=r file2 The a means all usersall three account types. All user accounts on the system can now look at the contents of file2. However, they can't write or execute it. |
|