LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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-22-2020, 07:40 AM   #1
sniper8752
Member
 
Registered: Oct 2012
Posts: 564

Rep: Reputation: Disabled
Changing umask permissions


I am running an app, and I would like to change the permissions that are applied when new files are created. Currently, when a new file is created, it looks like this: -rw-r--r--. Yet, umask -S returns this: u=rwx,g=rx,o=rx. Why are these not lining up?
 
Old 11-22-2020, 08:11 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Because umask doesn't affect the x flag. If you want a file to be executable, you must set x explicitly.

Actually, umask removes permission bits. Since the x flag is not set, it remains unset. More info: https://unix.stackexchange.com/quest...sions-on-files.

Last edited by berndbausch; 11-22-2020 at 08:12 AM.
 
Old 11-22-2020, 09:19 AM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
The umask setting only subtracts from the permissions that a program requests for new files. Most programs request mode rw-rw-rw- for files. Only a few programs (the linker, "ld", being the prime example) request execute permission.
 
  


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
Enhanceing login authentication + changing umask of local user to root josgeorge Red Hat 2 09-10-2009 01:51 AM
Group write access for newly created files/directories without changing umask fhd Linux - Security 3 04-05-2009 05:28 AM
Changing umask RHG Linux - Networking 2 10-20-2003 02:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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