Sorry to all Technical person for mistake of Question.
Now i am post currect question
Why copied file permission is changed in destination. When i
give all permission i.e 777 to file and copy that to other
location in destination the permission is 755. But if give
permission 555 in destination that file permission is 555
and if give permission 444 to file after copy in destination
the file permission is 444. These all are happening in
normal user. How the umask value is calculate here really i
am not understand. Please write the proper answer. Thanks
in Advance

Answers were Sorted based on User's Feedback



Sorry to all Technical person for mistake of Question. Now i am post currect question Why copied f..

Answer / green

Here i'll give u detailed explanation.
For file and directory permission
FOR read-4
write-2
execute-1

The format is something like this rwx:rwx:rwx

1st set of permission is for users
2nd set of permission is for groups
3rd set of permission is for others

Suppose u have a filename as file1. U want to give read
write and execute permission for USER, only read,execute
permission for GROUPS and again read, execute permission for
OTHERS
then command is like this:
chmod 755 file1
755: rwx:rw:rw

7=4+2+1=read+write+execute ---> THIS SET FOR USER
5=4+1=read+execute ---> THIS SET FOR GROUP
5=4+1=read+execute ---> THIS SET FOR OTHERS

UMASK:
Where as in the case of UMASK, it is little different.
Here we have separate umask values for files and
directories. First let us see how to set umask value for
directory
Instead of adding the values, u must subtract the values
from value 7. Let see the below example for ease understand.

Example1: To set umask for Directory like this rwx:rx:rx
7-4-2-1=0 --> user
7-4-1=2 --> group
7-4-1=2 --> others
so the umask value is like this
$ umask 022 Dir1

Example2: To set umask for Directory like this rwx:rw:rw
7-4-2-1=0 --> user
7-4-2=1 --> group
7-4-2=1 --> others
so the umask value is like this
$ umask 011 Dir1
where Dir1 is a directory.


To set umask for files as rwx:rx:rx
7-4-2-1=0 --> user
7-4=3 --> group
7-4=3 --> others
Usually there is no need for execute permission for files.
So no need to subtract for 1 for execute in the above
calculation. So the umask value set for files will be like this

$ umask 033 file1
where file1 is file....

Cheers, Vj

Is This Answer Correct ?    18 Yes 2 No

Sorry to all Technical person for mistake of Question. Now i am post currect question Why copied f..

Answer / vijeesh

The default file permission is 666 and directory perm. is
777, and umask default perm. is 022.
If you copied a file which is having 777 permission to
another location. umask will apply while copy the file.
hence 777 -(minus) 0222= 755 which is the default
permission of a file.

Is This Answer Correct ?    13 Yes 2 No

Sorry to all Technical person for mistake of Question. Now i am post currect question Why copied f..

Answer / hari

not problame to other users.
umask is user level permission
u give 666
after create file that permission is 666
u give 333 permission that umask calculate bello u see
666-333=333

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More Unix Commands Interview Questions

What is the use of the command 'ls -x chapter[1-5]' ?

0 Answers  


Who command in unix operating system?

0 Answers  


How do you find out all processes that are currently running in UNIX OS?

10 Answers  


what is the cmd to display the last exit status in UNIX?

5 Answers   MEIT, Syntel,


Assume the following files are in the working directory prompt> ls -l tasks -rw-r--r-- 1 alex student 1423 Feb 21 14:01 tasks What command can Alex use to give everyone permission to write to the file? What will the ls -l command display if he does so?

10 Answers   Infosys,






Does cp command overwrite files?

0 Answers  


What does 'mkdir' command do in UNIX?

0 Answers   Syntel, Visa,


which command is used to identify the type of the file?

3 Answers  


how to remotely move a file ??? that mean how to move a file one machine to another machine ???

10 Answers   Altair,


What is unix command line?

0 Answers  


Using unix command how to display no of records in oracle?

0 Answers  


why metadb requires a seperate slice to create Solaris volume manager

0 Answers   Wipro,


Categories