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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how to use grep command to list find the records of a file containing 10 different strings?

596


What does #!/ Bin sh do?

597


How do I use grep to search for a file?

584


What is the use of find command in unix?

588


What does touch command do in unix?

733






How do I use nslookup?

577


When i run a programm of orphan process. Instead of getting child's parent (ppid)=1 ..i get 1400 and it varies as per system. How can i findthe right soluion??? My pgm: #include # include int main() { int pid; pid=fork(); if(pid < 0) {exit(-1);} else if(pid==0) { printf("Child Process is Sleeping ..."); sleep(10); printf("Orphan Child's Parent ID : %u ",getppid()); } else { printf("Parent Process Completed ... %u ",getpid()); exit(0); } return 0; } Output:

1765


What is unix command?

584


What is the command to view process running?

578


what is the advaantage of each user having its own copy of the shell?

2039


What is the significance of the 'tee' command?

600


What are bash commands?

600


What is .sh file?

624


How do you repeat a command in terminal?

596


What does grep v do?

562