sliddjur
Posts: 5
Joined: Fri Aug 10, 2012 10:28 pm

Set default umask for users when they login?

Thu Sep 13, 2012 3:24 pm

Hello, I need some help setting the default umask for a user when they log in.

I tried to set umask 0002 in gecos field. Doesnt work.
I tried to change in /etc/login.defs. Doesnt work.

Still default 0022 when they login.
Need some help here.

User avatar
Licaon_Kter
Posts: 240
Joined: Wed Sep 05, 2012 10:12 am
Location: Between the keyboard and the chair.

Re: Set default umask for users when they login?

Thu Sep 13, 2012 3:27 pm

use umask in /etc/fstab ( man fstab ? )
BFQ+BFS or RT on a RPi? 4'real: https://github.com/licaon-kter/ (source and compiled!)

wamiduku
Posts: 3
Joined: Tue Nov 06, 2012 10:49 pm

Re: Set default umask for users when they login?

Tue Nov 06, 2012 11:15 pm

Licaon_Kter wrote:use umask in /etc/fstab ( man fstab ? )
I have the same problem and tried umask in fstab,

Code: Select all

proc            /proc           proc    defaults                     0       0
/dev/mmcblk0p1  /boot           vfat    defaults                     0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime,umask=0007             0       1
Doesn't work. It makes the file system read-only, which took an awful lot of googling to get out of, but no effect on umask which was still 0022. Any other way to fix the umask problem?

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Set default umask for users when they login?

Tue Nov 06, 2012 11:38 pm

How about the obvious - set it in /etc/profile?
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

wamiduku
Posts: 3
Joined: Tue Nov 06, 2012 10:49 pm

Re: Set default umask for users when they login?

Wed Nov 07, 2012 12:00 am

The /etc/profile file states that you shouldn't set it there:
/etc/profile wrote: # The default umask is now handled by pam_umask.
# See pam_umask(8) and /etc/login.defs.

User avatar
jojopi
Posts: 2986
Joined: Tue Oct 11, 2011 8:38 pm

Re: Set default umask for users when they login?

Wed Nov 07, 2012 8:42 am

That comment does not say that umask should not be set in /etc/profile, only that it is not.

For pam_umask to work, it would have to be mentioned somewhere in /etc/pam.d/, and it is not. So:

Code: Select all

echo "session optional pam_umask.so usergroups" |sudo tee -a /etc/pam.d/common-session
The "usergroups" argument may be sufficient for your purposes without changing login.defs, gecos, etc.

wamiduku
Posts: 3
Joined: Tue Nov 06, 2012 10:49 pm

Re: Set default umask for users when they login?

Wed Nov 07, 2012 11:09 am

jojopi wrote:That comment does not say that umask should not be set in /etc/profile, only that it is not.
So I just tried setting it in /etc/profile, and to my surprise it actually worked. Thanks!

Return to “Raspbian”

Who is online

Users browsing this forum: No registered users and 40 guests