LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-06-2012, 10:16 PM   #1
thiyagusham
Member
 
Registered: Apr 2012
Posts: 213

Rep: Reputation: Disabled
umask for files


Hai to all;

>> am i right ? >>

Directories, base permissions are 0777 (rwxrwxrwx)
Files , base are are 0666 (rw-rw-rw).

>> To calculate file permissions for a umask >>

[oracle@localhost ~]$ umask 077
[oracle@localhost ~]$ touch filey.txt
[oracle@localhost ~]$ mkdir touchdir1
[oracle@localhost ~]$
[oracle@localhost ~]$ ls -ld filey.txt touchdir1

-rw------- 1 oracle oinstall 0 Nov 7 08:33 filey.txt
drwx------ 2 oracle oinstall 4096 Nov 7 08:33 touchdir1

>> My question >>

IF file default permission is 666 , i got only 600 i.e.
owner only read & write . what abt group and others here ?

Thanks & Regards
Thiyagusham.G
 
Old 11-06-2012, 11:22 PM   #2
thiyagusham
Member
 
Registered: Apr 2012
Posts: 213

Original Poster
Rep: Reputation: Disabled
Hello to all ;

Please review attached screen shot ... I create single directory only
but why linux shows twice while listing .....
regards
Thiaygusham G
Attached Thumbnails
Click image for larger version

Name:	upload.png
Views:	19
Size:	218.7 KB
ID:	11162  
 
Old 11-07-2012, 02:44 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Re qn 1;
Default umask (& therefore perms) is usually set in /etc/profile. You subtract the umask values from 7 for each position.
If you use umask with symbolic notation (rwx), then it is set as those values.
http://www.cyberciti.biz/tips/unders...lue-usage.html
 
Old 11-07-2012, 02:51 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Re qn2 : when you ls a dir, it shows the content. If you cd into scriptdir, you'll see more clearly.
Every dir in *nix has 2 entries:

1 '.' current dir
2 '..' parent dir

http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/
 
Old 11-07-2012, 04:02 PM   #5
thiyagusham
Member
 
Registered: Apr 2012
Posts: 213

Original Poster
Rep: Reputation: Disabled
Hi chrism01

Thanks ..

Ya, Given link was very useful ... but having only one question

>> i need example 077 for files only >>

[rose@localhost ~]$ umask 077
[rose@localhost ~]$ touch oo.txt
[rose@localhost ~]$ mkdir oo
[rose@localhost ~]$ ls -al oo oo.txt
-rw------- 1 rose rose 0 Nov 8 02:15 oo.txt

oo:
total 8
drwx------ 2 rose rose 4096 Nov 8 02:15 .
drwx------ 7 rose rose 4096 Nov 8 02:15 ..

if i set 077 means linux subtracts 777-077 (directories) = 700 ok i am very clear ..

till hee no problem ..

i need explanation only for following command
-rw------- 1 rose rose 0 Nov 8 02:15 oo.txt

Quote:
Default permissions: 777 / 666
Subtract umask value: 077 (-)
Resulting permissions: 700 / 600

https://wiki.archlinux.org/index.php/Umask

Last edited by thiyagusham; 11-07-2012 at 06:38 PM.
 
Old 11-07-2012, 06:38 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
There's a default convention that newly created files (at the bash level) never automatically set execute perm on... If you think about it, there's a good reason (hint; security).
Its fine for dirs.
Have a good read of those links
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
umask and permissions: has umask 007 bad side effects? browny_amiga Linux - General 2 09-09-2011 09:01 AM
umask and /usr/bin/umask linux_user2011 Linux - Newbie 6 04-27-2011 03:05 AM
umask for cron and other log files vetteboy2 Linux - Security 1 03-16-2011 07:21 PM
Group write access for newly created files/directories without changing umask fhd Linux - Security 3 04-05-2009 06:28 AM
Question concerning fstab, umask, chmod and executable files pmdkh Linux - General 4 03-22-2009 12:31 AM


All times are GMT -5. The time now is 06:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration