Libellés

mercredi 1 décembre 2010

Umask pour un utilisateur avec sudo

Humm, voivi ma trouvaille du matin :
J'ai un umask pour mon utilisateur mais dès que je l'appelle via sudo, le umask n'est pas pris en compte.

Après quelques googlage, voici une solution qui marche sous debian : 

Tappez : 
visudo

Et ajoutez : 
Defaults>romain umask=0027

Et pour tester : 
sudo -u romain touch /tmp/titi

ls -l tmp/titi
-rw-r----- 1 romain  romain 0 nov 26 10:08 /tmp/titi


Et pour info voici les extraits du man sudoers : 

umask           Umask to use when running the command.  Negate this option or set it to 0777 to preserve the user's umask.  The default is 0022.


Defaults

Certain configuration options may be changed from their default values at runtime via one or more Default_Entry lines.  These may affect all users on any host, all users on a specific host, a specific user, or commands being run as a specific user.

        Default_Type ::= 'Defaults' |
                         'Defaults' '@' Host_List |
                         'Defaults' ':' User_List |
                         'Defaults' '>' Runas_List

Aucun commentaire:

Enregistrer un commentaire