LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   file permission !!! (https://www.linuxquestions.org/questions/linux-newbie-8/file-permission-871631/)

shipon_97 03-29-2011 01:47 AM

file permission !!!
 
Dear Friends ,

I have a following little query :

First in linux environment, I create a folder 'test' and give it 755 permission. Now I want a situation , when I create a subfolder as well as a file then it gets same 755 permission (permission folloed the above folder always) .

>[root@apps ~]#mkdir test
>[root@apps ~]# ls -l|grep test
>drwxr-xr-x 2 root root 4096 Mar 29 12:31 test
>[root@apps ~]# mkdir folder
>[root@apps ~]# cd test/
>[root@apps test]# mkdir folder
>[root@apps test]# touch file1
>[root@apps test]# ls -l
>total 4
>-rw-r--r-- 1 root root 0 Mar 29 12:32 file1
>drwxr-xr-x 2 root root 4096 Mar 29 12:32 folder


Here I got the 'folder' permission 755 but 'file1' permission is not 755 . How can I get 755 permission of 'file1' ?

Barring this when I copy a file from another place to this 'folder' then also I want to get same permission (755) of that file .

plz help me ... ...

T0sh1r0 03-29-2011 01:55 AM

you should have a look at umask (man umask or http://en.wikipedia.org/wiki/Umask) for instance)

16pide 03-29-2011 10:10 AM

the difference in rights that you get between your directory and your file can be explained this way:

a folder needs to have execution right to let you read what is in it. So by default you get this x

when a file has the execution right, it means it's a program or a script, and you can run it. So by default you don't get the "x" in the rights of files. This is a security protection.

You could run chmod a+x *
But I certainly don't recommend it!


All times are GMT -5. The time now is 03:07 AM.