LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   How Set Default Umask (https://www.linuxquestions.org/questions/slackware-14/how-set-default-umask-768938/)

Ani 11-13-2009 11:19 AM

How Set Default Umask
 
How do you set the default Umask setting for all users on the computer in Slackware?

I tried to change it in /etc/profile but it did not change for root or other users.
root is using /bin/bash and all other users are using /bin/false so they do not have a local .profile.

The other users are using the chroot option in openssh5.2 and thus using the "ForceCommand internal-sftp" option.
Anyone know what shell the internal-sftp is using?

I don't see a /etc/default/bashrc like on other distros.

HaroldWho 11-13-2009 03:02 PM

What about 'umask 022' in /etc/rc.d/rc.local

BTW, my /etc/profile contains the following:
Code:

# Default umask.  A umask of 022 prevents new files from being created
# group and world writable.
umask 022


jmccue 11-14-2009 08:49 AM

Hi Ani

/etc/login.defs
search for UMASK and change

Regards
Jack

rootaccess 01-04-2024 05:29 PM

I know this is old but if anyone is wondering, in slackware 15.0, /etc/login.defs has no effect if you change the umask. It must be done in /etc/profile for system-wide affect. then you must reboot

henca 01-05-2024 01:20 AM

1 Attachment(s)
Quote:

Originally Posted by rootaccess (Post 6474678)
It must be done in /etc/profile for system-wide affect. then you must reboot

There is no need to reboot to change the umask. In any shell you can alter the umask and simultaneously run different shells with different umask. You will get the default umask at login, but unfortunately, by default in Slackware most terminal windows are not starting their shells as login shells.

A really good idea is to within the settings of your terminal window choose something called something like "Run command as login shell".
Attachment 42344
For a terminal like xterm this can instead be choosen by starting xterm with the switch -ls or the X resource "*loginShell: True". For those few terminal programs lacking this setting it is usually instead possible to choose how the shell is started and add the switch -l for the shell.

By default in Slackware you will get a fortune cookie at each login, if you do not see such a fortune cooke at each start of a new terminal window that terminal window might not have been started as a login shell and the files in /etc/profile.d has not been run.

regards Henrik

Windu 01-05-2024 01:56 AM

Quote:

Originally Posted by rootaccess (Post 6474678)
I know this is old but if anyone is wondering, in slackware 15.0, /etc/login.defs has no effect if you change the umask. It must be done in /etc/profile for system-wide affect. then you must reboot

The man page for login.defs states:
Code:

      UMASK (number)
          The file mode creation mask is initialized to this value. If not
          specified, the mask will be initialized to 022.

          useradd and newusers use this mask to set the mode of the home
          directory they create if HOME_MODE is not set.

          It is also used by pam_umask as the default umask value.

Slackware does not use pam_umask but that's not the point. Why do you think that on Slackware this is not true?


All times are GMT -5. The time now is 12:32 AM.