Changing directory permissions, Using pattern-matching characters, Setting absolute permissions – HP NonStop G-Series User Manual

Page 126

Advertising
background image

Changing Directory Permissions

The procedure for changing directory permissions is the same as that for changing file permissions.
However, to list the information about a directory, you use the ls -ld command, as shown in
the following example:

$ ls -ld project

drwxr-xr-x 2 larry system 32 Jun 5 10:07 project

Now change the permissions with the chmod g+w command so that the group (g) also has write
permission (+w) for the directory /project:

$ chmod g+w project

$ ls -ld project

drwxrwxr-x 2 larry system 32 Jun 5 10:07 project

Using Pattern-Matching Characters

If you want to make the same change to the permissions of all entries in a directory, you can use
the pattern-matching character * (asterisk) with the chmod command.

In the following example, the command chmod g+x * adds execute permission (+x) to the group
(g) for all files (*) in the current directory:

$ chmod g+x *

Now enter the ls -l command to show that the group now has execute permission for all files
in the current directory:

$ ls -l

total 7

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

-rw-r-xr-- 1 larry system 171 Jun 5 10:03 file2

-rw-r-xr-- 1 larry system 130 Jun 5 10:06 file3

drwxrwxr-x 2 larry system 32 Jun 5 10:07 project

-rw-r-xr-- 1 larry system 0 Jun 5 11:03 record1

-rw-r-xr-- 1 larry system 0 Jun 5 11:03 record6

drwxr-xr-x 2 larry system 32 Jun 5 10:31 reports

Setting Absolute Permissions

An absolute permission assignment (=) assigns all permissions for a file or files, regardless of what
the permissions were previously. In the following example, the ls -l command lists the permissions
for the file3 file. Then the command chmod a=rwx assigns all permissions (rwx) for a file to all
users (a):

$ ls -l file3

-rw-r-xr-- 1 larry system 130 Jun 5 10:06 file3

$ chmod a=rwx file3

$ ls -l file3

-rwxrwxrwx 1 larry system 130 Jun 5 10:06 file3

126

Managing Access to Files and Directories

Advertising
This manual is related to the following products: