12.07.2015 Views

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

File Permissions 117As you can probably guess, within each set of permissions, the r stands for read, the wstands for write, and the x stands for execute. If the file is a script or command, you musthave execute permission to run it. You must also have execute permission to change intoa directory.To change file permissions, you must be the owner of the file or directory or be the rootuser. The chmod utility is used to modify file permissions. The basic syntax is as follows:chmod [ugoa][+-=] filenameFor the first argument, choose one or more of the letters ugoa, where u stands for the userwho owns the file (the first set of permissions), g stands for everyone in the file’s group(the second set of permissions), o stands for other users not in the file’s group (the thirdset of permissions), and a stands for all users (all three sets of permissions). The differencebetween specifying o and a is that o changes the third set of permissions for everyone anda changes the permissions for all three sets.4The second argument must be one of +, -, or =. If the plus sign (+) is used, the permissionsthat follow it are added for the users and groups provided by the first argument. Ifthe minus sign (-) is used, the permissions that follow are removed for the users andgroups in the first argument. Normally, when the chmod command is used, the permissionsare added to the existing ones. However, if the equals sign (=) is used, the file willonly have the permissions being specified (the existing permissions are overwritten andnot retained).The last argument is a filename or group of filenames on which to set the permissions.Multiple filenames can be listed using the * wildcard character such as *.txt for all filesending in .txt.The third argument is the list of permissions for the users and groups fromthe first argument. The list can consist of one or more of the permissions in Table 4.4.TABLE 4.4 chmod File PermissionsPermission DescriptionrReadwWritexExecute (also gives permission to change into a directory)XExecute only if it is a directory or has execute permission for some usersSet user or group ID on executiontSticky bituPermissions granted to user who owns the filegPermissions granted to users in the file’s groupoPermissions granted to the owner of the group and the users in the file’s groupThe first three (r, w, x) are self-explanatory. Use them to set read, write, and executepermissions.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!