Sudo: /etc/sudoers: N'est pas un dossier

La commande ci-dessous éteint effectivement la machine, mais je me demande pourquoi j’ai droit aux lignes suivantes:

":~$ sudo /usr/sbin/shutdown -h now
sudo: /etc/sudoers: N’est pas un dossier
[sudo] password for jean-pierre: "

Peut-être y a t-il quelque chose à faire et que j’ai omise ?

Il y a du nouveau, la commande ne fonctionne plus. :wink:

“:~$ sudo /usr/sbin/shutdown -h now
sudo: /etc/sudoers: N’est pas un dossier
[sudo] password for jean-pierre:
Sorry, try again.
[sudo] password for jean-pierre:
sudo: /usr/sbin/shutdown: command not found
jean-pierre@Jean-Pierre-PC:~$ sudo /usr/sbin/shutdown -h now
sudo: /etc/sudoers: N’est pas un dossier
[sudo] password for jean-pierre:
sudo: /usr/sbin/shutdown: command not found” :115

peux tu faire visudo en root et le poster ici ?

Oui, bien volontiers,

"This file MUST be edited with the ‘visudo’ command as root.

Please consider adding local content in /etc/sudoers.d/ instead of

directly modifying this file.

See the man page for details on how to write a sudoers file.

Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:$

Host alias specification

User alias specification

Cmnd alias specification

User privilege specification

root ALL=(ALL:ALL) ALL
ALL ALL=NOPASSWD: /sbin/shutdown -h now

Allow members of group sudo to execute any command

%sudo ALL=(ALL:ALL) ALL

See sudoers(5) for more information on “#include” directives:

#includedir /etc/sudoers

Je ne vois pas d’erreur de syntaxe dans “ALL ALL=NOPASSWD: /sbin/shutdown -h now” :017

Tu avais tapé :

alors que c’est :

ou

mais

$ sudo halt

suffit

J’ai essayé “sudo halt” mais quelque chose ne va pas…

jean-pierre@Jean-Pierre-PC:~$ sudo halt
sudo: /etc/sudoers: N’est pas un dossier
[sudo] password for jean-pierre:
Sorry, user jean-pierre is not allowed to execute ‘/sbin/halt’ as root on Jean-Pierre-PC.home.
jean-pierre@Jean-Pierre-PC:~$ :wink:

Salut,

[quote=“manas”]J’ai essayé “sudo halt” mais quelque chose ne va pas…


Désolé, Jean-Pierre utilisateur n’est pas autorisé à exécuter ‘/sbin/halt’ comme root sur Jean-Pierre-PC.home.

[/quote]

/etc/sudoers ?

[quote=“manas”] [code] "This file MUST be edited with the ‘visudo’ command as root.

Please consider adding local content in /etc/sudoers.d/ instead of

directly modifying this file.

See the man page for details on how to write a sudoers file.

Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:$

Host alias specification

User alias specification

Cmnd alias specification

User privilege specification

root ALL=(ALL:ALL) ALL
ALL ALL=NOPASSWD: /sbin/shutdown -h now

Allow members of group sudo to execute any command

%sudo ALL=(ALL:ALL) ALL

See sudoers(5) for more information on “#include” directives:

#includedir /etc/sudoers [/code] [/quote]
La dernière ligne remarquable :

includedir, dir comme “directory”, dossier. Le message d’erreur fait savoir que /etc/sudoers n’est pas un dossier. Tu as dû escamoter la ligne en l’éditant.
Corrige la ligne en précisant le dossier /etc/sudoers.d

Contenu de /etc/sudoers.d/README

[code]#

As of Debian version 1.7.2p1-1, the default /etc/sudoers file created on

installation of the package now includes the directive:

#includedir /etc/sudoers.d

This will cause sudo to read and parse any files in the /etc/sudoers.d

directory that do not end in ‘~’ or contain a ‘.’ character.

Note that there must be at least one file in the sudoers.d directory (this

one will do), and all files in this directory should be mode 0440.

Note also, that because sudoers contents can vary widely, no attempt is

made to add this directive to existing sudoers files on upgrade. Feel free

to add the above directive to the end of your /etc/sudoers file to enable

this functionality for existing installations if you wish!

Finally, please note that using the visudo command is the recommended way

to update sudoers content, since it protects against many failure modes.

See the man page for visudo for more information.

[/code]
/etc/sudoers.d est complémentaire de /etc/sudoers. Tu n’as pas besoin de le garnir pour que /etc/sudoers soit actif.

[quote=“etxeberrizahar”]Tu as dû escamoter la ligne en l’éditant.
[/quote]
Cette subtilité m’échappe …

* edit *

Je n’ai rien dit.

[23:44:40][root@domaine] ~ # cat /etc/sudoers ... #includedir /etc/sudoers.d [23:44:44][root@domaine] ~ #

[quote=“man sudoers”] Including other files from within sudoers
It is possible to include other sudoers files from within the sudoers file currently being parsed using the #include and #includedir directives.

   This can be used, for example, to keep a site-wide sudoers file in addition to a local, per-machine file.  For the sake of this example the site-wide sudoers will be
   /etc/sudoers and the per-machine one will be /etc/sudoers.local.  To include /etc/sudoers.local from within /etc/sudoers we would use the following line in
   /etc/sudoers:

       #include /etc/sudoers.local

   When sudo reaches this line it will suspend processing of the current file (/etc/sudoers) and switch to /etc/sudoers.local.  Upon reaching the end of
   /etc/sudoers.local, the rest of /etc/sudoers will be processed.  Files that are included may themselves include other files.  A hard limit of 128 nested include files
   is enforced to prevent include file loops.

   If the path to the include file is not fully-qualified (does not begin with a /), it must be located in the same directory as the sudoers file it was included from.
   For example, if /etc/sudoers contains the line:

       #include sudoers.local

   the file that will be included is /etc/sudoers.local.

   The file name may also include the %h escape, signifying the short form of the host name.  I.e., if the machine's host name is "xerxes", then

   #include /etc/sudoers.%h

   will cause sudo to include the file /etc/sudoers.xerxes.

   The #includedir directive can be used to create a sudo.d directory that the system package manager can drop sudoers rules into as part of package installation.

For
example, given:

   #includedir /etc/sudoers.d

   sudo will read each file in /etc/sudoers.d, skipping file names that end in ~ or contain a . character to avoid causing problems with package manager or editor
   temporary/backup files.  Files are parsed in sorted lexical order.  That is, /etc/sudoers.d/01_first will be parsed before /etc/sudoers.d/10_second.  Be aware that
   because the sorting is lexical, not numeric, /etc/sudoers.d/1_whoops would be loaded after /etc/sudoers.d/10_second.  Using a consistent number of leading zeroes in
   the file names can be used to avoid such problems.

   Note that unlike files included via #include, visudo will not edit the files in a #includedir directory unless one of them contains a syntax error.  It is still
   possible to run visudo with the -f flag to edit the files directly.

[/quote]
Je recherche une traduction viable …

Oui, maintenant cela fonctionne !
J’ai du effacer le “.d” de #includedir /etc/sudoers.d
en éditant.
Je n’aurai pas pu trouver tout seul…et je ne voulais pas me contenter d’éteindre la machine à partir du bureau.Nous sommes j’imagine quelques lambda à découvrir Debian grâce à votre petite tribu, oasis bien rafraîchissante et rencontre bien improbable_ tant le désert du commercial se fait envahissant.
Je suis bien étonné!

tu découvres ce que « communauté » veut dire !

[…] oasis […] désert […]

Ca m’fait penser au vieux sage dans une tente :