Ad Code

5.2 Changing access rights

chmod (changing a file mode)

Only the owner of a file can use chmod to change the permissions of a file. The options of chmod are as follows

SymbolMeaning
u user
g group
oother
a all
r read
wwrite (and delete)
x execute (and access directory)
+ add permission
- take away permission


For example, to remove read write and execute permissions on the file biglist for the group and others, type

% chmod go-rwx biglist

This will leave the other permissions unaffected.

To give read and write permissions on the file biglist to all,

% chmod a+rw biglist

Exercise 5a

Try changing access permissions on the file science.txt and on the directory backups

Use ls -l to check that the permissions have changed.

Post a Comment

0 Comments