infoLinux

Linux Octal File Permissions Introduction

The Octal permissions can also be set for the groups.

Here : To set,

r octal will be 4.

w octal will be 2.

octal will be 1.

File Octal Table:

binary octal permissions
000 0 —
001 1 –x
010 2 -w-
011 3 -wx
100 4 r–
101 5 r-x
110 6 rw-
111 7 rwx

From this we can conclude that are below :

777 = rwxrwxrwx  765 = rwxrw-r-x  654 = rw-r-xr–

Now we can have shown some random octal examples with the numbers 777, 274 and 111.

Linux umask command

The default permissions are viewed by umask command.

Every safety reasons all Unix systems and Linux system doesn’t provide execution permission to newly created files.

Now adding execution permission is upto you.

mkdir -m

The mkdir -m command can be used to set the mode.

Sample syntax of :

# mkdir -m <mode> <fileName>

Like example of :

# mkdir -m 777 new1  # mkdir -m 000 new2

See your terminal after run the command, we have created two files new1 and new2 with mode 777 and 000 respectively.

cp -p

Command cp -p preserves the permissions and it is can time stamps from source files.

Sample syntax of :

# cp -p <sourceFile> <destinationFile>

Like example of :

# cp -p list dupli.txt

See your terminal after run the command, earlier permissions for files list and dupli.txt were different.

Here you can see after passing the command “cp -p list dupli.txt”, both the files have same permissions.

The Linux or Unis Every file and directory has an owner. Every associated Unix groupLinux group and set of permission flags that specify separate readwrite, and execute permissions for the userownergroup, and other. The group permissions apply to all users, which are belong to the group associated with the file system. Permission of Other is also sometimes known as world permissions. It applies to all users who can login to the system. Linux ls l command is displays the permissions and associated group for any file.

If you run the command your terminal then you can see like below :

drwx—— 2 elvis elvis  2048 Jun 12 2012  private-rw——- 2 elvis elvis  1327 Apr  9 2012  try.f90-rwx—— 2 elvis elvis 12040 Apr  9 2012  a.outdrwxr-x— 2 elvis bigsci 2048 Oct 17 2011  sharedrwxr-xr-x 3 elvis bigsci 2048 Nov 13 2011  public

See your terminal after run the command, you can see your terminal above example like or your file description.

If you understand this article. please practice your own ability. Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *