beautypg.com

Changing file permissions – HP NonStop G-Series User Manual

Page 125

background image

the file or files whose permissions you want to change. You can also use pattern-matching characters
to specify files.

The userclass-operation-permission code is defined as follows:

Use one or more of these letters to represent the user class:

User (owner)

u

Group

g

All others (besides owner and group)

o

All (user, group, and all others)

a

Use one of these symbols to represent the operation:

Add permission

+

Remove permission

-

Assign permission regardless of previous setting

=

Use one or more of these letters to represent the type of permission:

Read

r

Set user ID or group ID

s

Write

w

Execute

x

Set sticky bit

t

Changing File Permissions

This subsection shows you how to change the access permissions for a file. In the following example,
first enter the ls -l command to display the permissions for the file file1:

$ ls -l file1

-rw-r--r-- 1 larry system 101 Jun 5 10:03 file1

Note that the owner (larry) has read and write permissions, while the group and others have
only read permissions.

Now, enter the chmod command with the flags go+w. This command expands the permissions for
both the group (g) and for others (o) by adding write permission (+w) to file1 in addition to the
read permission they already have:

$ chmod go+w file1

Next, list the new permissions for the file:

$ ls -l file1

-rw-rw-rw- 1 larry system 101 Jun 5 10:03 file1

Note that you have given your group and all other system users write permission to file1.

Setting File and Directory Permissions (chmod)

125

This manual is related to the following products: