Computer Science - Unix - Discussion
Discussion Forum : Unix - Section 2 (Q.No. 16)
16.
Which of the following commands is used to absolutely assign all permissions to the owner, read and write permissions to the group and only executable permission to the others of the file note?
Discussion:
2 comments Page 1 of 1.
SCB said:
1 decade ago
You can use octal number to represent mode/permission:
* r: 4
* w: 2
* x: 1
For example, for file owner you can use octal mode as follows. Read, write and execute (full) permission on a file in octal is
0+r+w+x = 0+4+2+1 = 7
Only Read and write permission on a file in octal is
0+r+w+x = 0+4+2+0 = 6
Only read and execute permission on a file in octal is
0+r+w+x = 0+4+0+1 = 5
Use above method to calculate permission for group and others. Let us say you wish to give full permission to owner, read & execute permission to group, and read only permission to others, then you need to calculate permission as follows:
User = r+w+x = 0+4+2+1 = 7
Group= r+w+x = 0+4+2+0 = 6
Others = r+w+x = 0+0+0+1 = 1
Effective permission is 761.
* r: 4
* w: 2
* x: 1
For example, for file owner you can use octal mode as follows. Read, write and execute (full) permission on a file in octal is
0+r+w+x = 0+4+2+1 = 7
Only Read and write permission on a file in octal is
0+r+w+x = 0+4+2+0 = 6
Only read and execute permission on a file in octal is
0+r+w+x = 0+4+0+1 = 5
Use above method to calculate permission for group and others. Let us say you wish to give full permission to owner, read & execute permission to group, and read only permission to others, then you need to calculate permission as follows:
User = r+w+x = 0+4+2+1 = 7
Group= r+w+x = 0+4+2+0 = 6
Others = r+w+x = 0+0+0+1 = 1
Effective permission is 761.
Suraj said:
9 years ago
How select a read = 4 & write = 2.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers