Problème avec Sudoers (NOPASSWD)

Davidax

Membre enregistré
20 Mai 2012
2
0
Bonjour à tous !

J'ai créé un script (.sh) qui permet d'activer mon serveur SSH.

sudo -s /bin/launchctl load -w /System/Library/LaunchDaemons/ssh.plist
Le mot de passe est demandé, j'ai donc ajouté la ligne suivante dans sudoers et tout fonctionne parfaitement.

MonCompte ALL=(ALL) NOPASSWD: ALL
Sauf que ça pose quelques problèmes niveau sécurité alors j'ai tenté de modifier mon sudoers de manière à ce qu'une seule commande soit soumis au "NOPASSWD".

Aucune des lignes ci-dessous fonctionne ! :mad:

ALL ALL= NOPASSWD: /bin/launchctl load -w /System/Library/LaunchDaemons/ssh.plist
MonCompte ALL=(ALL) NOPASSWD: /bin/launchctl load -w /System/Library/LaunchDaemons/ssh.plist
MonCompte ALL= NOPASSWD: /bin/launchctl load -w /System/Library/LaunchDaemons/ssh.plist
MonCompte ALL=(ALL) NOPASSWD: /bin/launchctl *
MonCompte ALL=(ALL) NOPASSWD: /bin/launchctl load -w /System/Library/LaunchDaemons/ssh.plist
MonCompte ALL=(ALL) NOPASSWD: /Chemin_dacces_a_mon_script/script.sh
Qu'est ce qui ne va pas ?

Merci d'avance pour votre aide !
 
Problème résolu : j'ai simplement retirer l'argument "-s" de ma commande et ça fonctionne... Pourquoi ? Aucune idée.

sudo -s fonctionne avec "MonCompte ALL=(ALL) NOPASSWD: ALL" et rien d'autre
sudo (sans arguments) fonctionne avec "MonCompte ALL=(ALL) NOPASSWD: /bin/launchctl load -w /System/Library/LaunchDaemons/ssh.plist"
 
Skimlinks