Google News
logo
Unix - Interview Questions
Can you explain the method of changing file access permission in Unix?

There are three components of a file permissions

Owner permissions − This determines what actions the owner of the file can perform.
Group permissions − This determines what actions a group member(of the group that a file belongs to) can perform.
Other (world) permissions − This is for everyone else.
$ ls -l /home/sroy8091
-rwxr-xr--  1 sroy8091   users 1024  Feb  23 00:10  myfile
drwxr-xr--- 1 sroy8091   users 1024  Feb  23 00:10  mydir?

r, w, and x represent read, write and execute respectively.

To change the file permission we need to run chmod command.
$ ls -l testfile
-rwxrwxr--  1 sroy8091   users 1024  Feb 23 00:10  testfile
$ chmod o+wx testfile
$ ls -l testfile
-rwxrwxrwx  1 sroy8091   users 1024  Feb 23 00:10 testfile?

Here we updated the permission for other users, from only read to read, write and execute.
Advertisement