LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-31-2012, 09:18 AM   #1
fakie_flip
Senior Member
 
Registered: Feb 2005
Location: San Antonio, Texas
Distribution: Gentoo Hardened using OpenRC not Systemd
Posts: 1,495

Rep: Reputation: 85
umask


When setting the umask, does it only get applied to that directory or the entire filesystem?

Example as root user:
Code:
mkdir /shareddir
cd /shareddir
umask 027
Does that umask get applied for the directory or the entire file system? Then it would be a bad idea to change it if it didn't affected the entire filesystem where distro packages update files and install new ones? The video I was watching created a group "research", added project members to it and created a shared directory located at the root of the filesystem. And then used umask on it and turned sticky bit on for it. But it sounds like a bad idea if it affected the entire filesystem. I've seen umask used in fstab, and it was for the entire filesystem.
 
Old 10-31-2012, 10:04 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,842

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
see man bash:
The user file-creation mask is set to mode. If mode begins with a digit, it is interpreted as an octal number; otherwise it is interpreted as a symbolic mode mask similar to that accepted by chmod(1). If mode is omitted, the current value of the mask is printed. The -S option causes the mask to be printed in symbolic form; the default output is an octal number. If the -p option is supplied, and mode is omitted, the output is in a form that may be reused as input. The return status is 0 if the mode was successfully changed or if no mode argument was supplied, and false otherwise.
and see man mkdir

this is a file creation mask, it is used when you create new file/dir, it should be set before the mkdir command.
 
Old 11-01-2012, 07:34 AM   #3
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
chmod is the command for changing an existing file/directory mode.
compare "chmod o-w /shareddir" with "chmod -R o-w /shareddir"


umask affects the mode of files/directories you create in the future. It's a value that exists in your process (e.g. your shell session) and not a value defined for a whole filesystem.
umask 022 ; mkdir u022
umask 027 ; mkdir u027
umask 077 ; mkdir u077
ls -lad u*
exit

Last edited by linosaurusroot; 11-01-2012 at 07:35 AM.
 
  


Reply



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 08:01 AM
umask and /usr/bin/umask linux_user2011 Linux - Newbie 6 04-27-2011 02:05 AM
what is Umask ? tofee Linux - Newbie 1 03-23-2006 07:05 AM
umask help glabiche Linux - Security 1 06-07-2005 08:20 AM
Umask robyso Linux - Security 1 07-14-2003 02:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:20 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
Open Source Consulting | Domain Registration