Access Control in Unix

 

Introduction- the basics:

Controlling access to files:

Let's do another example: Issue a 'ls -lt' and assume we see:

drwxrwxr-x.  2 jjm jjm      4096 Apr 20 21:01 tmp

-rw-rw-r--.  1 jjm jjm     86112 Apr 20 17:16 resultsEXP1.tar.gz

Let's talk about these two lines. The first group of information is the 'permission bits'. The second field (with the number 2 or 1) indicates the number of links or directories in the current directory. We usually use octal numbers to represent the permission bits.

 

Changing Files Modes or File Permissions

Note: information related to Ubuntu is here..

Summary: The access privileges are sometimes called the mode of the file or directory.o change the mode. Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=][0-7]+'. The notation is based on :

The chmod command is used to change the mode. For example: $chmod g-rw filename. Alternatively, chmod will accept octal encoding of the bits. For example, create a script file ex.sh and place a line of text in the file. On a ubuntu 16.04 system, the permissions are set to

-rw-rw-r-- 1 jjm jjm 474 Jan 28 16:29 ex.sh

To make this file read/write/executable by the owner, and exectutable by users from the group or the world, we could do either: >chmod 755 ex.sh or >chmod u+rwx

-rwxr-xr-x 1 jjm jjm 474 Jan 28 16:29 ex.sh

As another example, safe permission settings for your web site directories would be exececute permissions to everyone so they can get step into directories:  'chmod a+x ./'   AND then add  read permission to others on all files that can be viewed by web browsers:  'chmod o+r ./ .

Controlling who can execute programs

Relevant Unix commands.

 


Last update: 4/26/2017