Author Topic: umask setting ?  (Read 284 times)

Offline stealth

  • Hero Member
  • *****
  • Posts: 642
umask setting ?
« on: January 05, 2013, 04:09:28 PM »
All settings in these files are still set as they were from initial install from a stock PCLOS iso file

/etc/bashrc shows the umask will be set to 002 or 022 it also says profile is where the environment stuff goes. It also says create a custom.sh and put it in /etc/profile.d/

/etc/profile shows the umask is 022

So how are my new files always getting permissions of 664 instead of 644?  ??? What file is the best one to change the setting so all new files get permissions of 644 and not 664?

Offline muungwana

  • Hero Member
  • *****
  • Posts: 6236
Re: umask setting ?
« Reply #1 on: January 05, 2013, 05:12:30 PM »

what does your ".bashrc" file say?

Its a hidden file in your home directory.

If you can add an entry there to override the system wide default one.
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..

Offline stealth

  • Hero Member
  • *****
  • Posts: 642
Re: umask setting ?
« Reply #2 on: January 05, 2013, 05:24:17 PM »
# .bashrc

# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# fif=Find in File (maik3531)
# e.g. to search for the word 'pencil' in all documents of a given
# directory open a konsole, cd to the directory, and run: fif "pencil"
fif() {
find . -type f -print | xargs grep --color=auto "$1" 2> /dev/null
}

It is referencing /etc/bashrc and that has:

if [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]; then
        umask 002
else
        umask 022
fi

So apparently it is using the first choice even though /etc/profile shows:

# /etc/profile -*- Mode: shell-script -*-
# (c) MandrakeSoft, Chmouel Boudjnah <chmouel@mandrakesoft.com>

loginsh=1

if [ "$UID" -ge 500 ] && ! echo ${PATH} |grep -q /usr/games ; then
    PATH=$PATH:/usr/games
fi

umask 022

USER=`id -un`
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
HISTCONTROL=ignoredups
HOSTNAME=`/bin/hostname`
HISTSIZE=1000

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
    INPUTRC=/etc/inputrc
fi


I don't understand this from the /etc/bashrc

if [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ];

That is probably determining the umask setting.

 then
        umask 002
else
        umask 022
fi

Offline muungwana

  • Hero Member
  • *****
  • Posts: 6236
Re: umask setting ?
« Reply #3 on: January 05, 2013, 05:51:51 PM »

The option that will be used is the last one that will be set,so just add the following line to the end of the file,log out,log back in and files will now be created with 644 permissions.

umask 022
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..

Offline stealth

  • Hero Member
  • *****
  • Posts: 642
Re: umask setting ?
« Reply #4 on: January 05, 2013, 05:58:14 PM »
Which file? ~/.bashrc or ~/.bash_profile

Offline muungwana

  • Hero Member
  • *****
  • Posts: 6236
Re: umask setting ?
« Reply #5 on: January 05, 2013, 06:48:09 PM »

you can put in both,it shouldnt matter.

if you are to put in one,put it in ~/.bashrc
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..