Next: , Previous: Copying Permissions, Up: Symbolic Modes



6.2.3 Changing Special Permissions

In addition to changing a file's read, write, and execute permissions, you can change its special permissions. See Mode Structure, for a summary of these permissions.

To change a file's permission to set the user ID on execution, use u in the users part of the symbolic mode and s in the permissions part.

To change a file's permission to set the group ID on execution, use g in the users part of the symbolic mode and s in the permissions part.

To change a file's permission to stay permanently on the swap device, use o in the users part of the symbolic mode and t in the permissions part.

For example, to add set user ID permission to a program, you can use the mode:

     u+s

To remove both set user ID and set group ID permission from it, you can use the mode:

     ug-s

To cause a program to be saved on the swap device, you can use the mode:

     o+t

Remember that the special permissions only affect files that are executable, plus, on some systems, directories (on which they have different meanings; see Mode Structure). Using a in the users part of a symbolic mode does not cause the special permissions to be affected; thus,

     a+s

has no effect. You must use u, g, and o explicitly to affect the special permissions. Also, the combinations u+t, g+t, and o+s have no effect.

The = operator is not very useful with special permissions; for example, the mode:

     o=t

does cause the file to be saved on the swap device, but it also removes all read, write, and execute permissions that users not in the file's group might have had for it.