Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Other Things Gentoo
  • Search

[SOLVED] Different umask for a certain user - how?

Still need help with Gentoo, and your question doesn't fit in the above forums? Here is your last bastion of hope.
Post Reply
Advanced search
8 posts • Page 1 of 1
Author
Message
Guinpen
Guru
Guru
User avatar
Posts: 393
Joined: Wed Dec 08, 2004 1:18 pm
Contact:
Contact Guinpen
Website

[SOLVED] Different umask for a certain user - how?

  • Quote

Post by Guinpen » Thu Jul 09, 2009 8:21 am

Hello,

I would like to keep the default global umask, but modify it for a given user, no matter how that user logs in (console, X terminal, ssh). How would I do that?

Thanks!
Last edited by Guinpen on Tue Aug 18, 2009 9:22 pm, edited 1 time in total.
Top
grooveharder
n00b
n00b
Posts: 44
Joined: Sun Feb 18, 2007 5:35 pm

  • Quote

Post by grooveharder » Thu Jul 09, 2009 10:18 am

how about putting in /etc/profile:

Code: Select all

if [ "$EUID" = "(uid)" ]
then umask (whatever)
fi
Top
Guinpen
Guru
Guru
User avatar
Posts: 393
Joined: Wed Dec 08, 2004 1:18 pm
Contact:
Contact Guinpen
Website

  • Quote

Post by Guinpen » Thu Jul 09, 2009 9:28 pm

Unfortunately, if I log in as the user with 077, and run something as root ("sudo bash"), root now inherits the umask. Is there a way to guarantee that the right umask is used in all circumstances?
Top
Guinpen
Guru
Guru
User avatar
Posts: 393
Joined: Wed Dec 08, 2004 1:18 pm
Contact:
Contact Guinpen
Website

  • Quote

Post by Guinpen » Thu Jul 30, 2009 2:07 pm

Anyone?
Top
Mike Hunt
Watchman
Watchman
User avatar
Posts: 5287
Joined: Sun Jul 19, 2009 11:01 pm

  • Quote

Post by Mike Hunt » Thu Jul 30, 2009 4:31 pm

Does this work?
Top
Guinpen
Guru
Guru
User avatar
Posts: 393
Joined: Wed Dec 08, 2004 1:18 pm
Contact:
Contact Guinpen
Website

  • Quote

Post by Guinpen » Sat Aug 01, 2009 11:14 am

The following line fixed sudo's umask:

Code: Select all

Defaults !set_logname, syslog=auth, umask=022, umask_override
This is almost what I want. The only thing left is su. When I su from my user to get root, the umask does not change.
Top
Mike Hunt
Watchman
Watchman
User avatar
Posts: 5287
Joined: Sun Jul 19, 2009 11:01 pm

  • Quote

Post by Mike Hunt » Sat Aug 01, 2009 3:09 pm

How about something like this?

Code: Select all

alias su='su -'
The '-' tells bash it is a login session, thus forcing the read
of /etc/profile. See man su. :P
Top
Guinpen
Guru
Guru
User avatar
Posts: 393
Joined: Wed Dec 08, 2004 1:18 pm
Contact:
Contact Guinpen
Website

  • Quote

Post by Guinpen » Tue Aug 18, 2009 9:22 pm

That's what I was looking for! But this line has the bug that providing any options to the su command ignores the dash, since according to TFM it has to be the last option. The perfect solution is:

Code: Select all

alias su='su -l'
Thanks!
Top
Post Reply

8 posts • Page 1 of 1

Return to “Other Things Gentoo”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy