sudoers jetzt sudoers.d [Gelöst]

Begonnen von exot, 05 November 2018, 19:57:59

Vorheriges Thema - Nächstes Thema

exot

Hallo,
etc/ sudoers gibt es nicht mehr bei mir.
Dafür eine etc/sudoers.d
Ich benötige aber die alte Version, sudoers,
denn zur Widerherstellung meiner Brennraumtemperatur
muss dort ein Zusatz eingefügt werden.
Wie kann ich das bewerkstelligen.
Gruß Michael

MadMax-FHEM

#1
Welches System?
Hardware bzw. wichtiger welches OS!?

Im /etc/sudoers.d Verzeichnis liegen die Dateien (pro User).

Bei einem PI beispielsweise:

-r--r-----  1 root root   27 Okt 18  2016 010_pi-nopasswd

Der Inhalt sollte dann "der alte" sein:

pi ALL=(ALL) NOPASSWD: ALL

Also entweder eine vorhandene Datei anpassen oder (für einen anderen User) eine weitere anlegen und dann den Inhalt entsprechend eintragen...

Gruß, Joachim
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

RaspiLED

Voila:

sudoers
#
# 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:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL
pi    ALL=(ALL:ALL) NOPASSWD:ALL
fhem    ALL=(ALL:ALL) NOPASSWD:/bin/systemctl

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) NOPASSWD:ALL

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

#includedir /etc/sudoers.d



Gesendet von iPhone mit Tapatalk
Raspberry Pi mit FHEM, CUL, Signalduino, MySensors, HomeBridge, Presence, WifiLight2, Bravia, ...

exot

Hallo,
Danke für Eure schnellen Nachrichten.
Debian 9.5
Habe die Datei gefunden.
cd /etc
sudo nano w /etc/sudoers 
;) ;) ;)
verstehe nur nicht, das die Datei leer ist.
Gruß Michael

MadMax-FHEM

#4
Siehe meine Antwort zuvor.

Schon mal in das Verzeichnis /etc/sudoers.d/ geschaut!?

EDIT:
Zitat
Why use /etc/sudoers.d/

Typically /etc/sudoers is under control of your distribution's package manager. If you have made changes to that file and the package manager wants to upgrade it, you will have to manually inspect the changes and approve how they are merged into the new version. By placing your local changes into a file in the /etc/sudoers.d/ directory, you avoid this manual step and upgrades can proceed automatically.

Gruß, Joachim
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

exot

ja,
da sind zwei Dateien drin.
010_pi-nopasswd und README
Gruß Michael

MadMax-FHEM

#6
Dann kopier doch einfach die Datei vom User pi und passe sie an...
...habe ich so gemacht, um für den User fhem ebenfalls sudo für einen Befehl zu ermöglichen...


-r--r-----  1 root root   27 Okt 18  2016 010_pi-nopasswd
-r--r-----  1 root root   29 Sep 16  2017 020_fhem-nopasswd
-r--r-----  1 root root  958 Jun  5  2017 README


EDIT: dann hast du einen RaspberryPI!? Allerdings ist meine /etc/sudoers nicht leer...


#
# 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:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root ALL=(ALL:ALL) ALL

# 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.d


Gruß, Joachim
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

exot

hallo Joachim,
habe ich gemacht und dann noch
   fhem ALL=(ALL) NOPASSWD: ALL 
eingefügt. Damit wird die Brennraumtemperatur wieder angezeigt.
Danke
Gruß Michael

MadMax-FHEM

Gerne!

Aber evtl. das NOPASSWD: ALL nochmal überdenken.
Man kann auch nur bestimmte Kommandos etc. angeben...

Nur so als Anmerkung...

Gruß, Joachim
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

RaspiLED

Moin,
Schau in meinem Post oben, wie man FHEM nur einzelne Befehle (inkl. Pfad) erlaubt!
Gruß Arnd


Gesendet von iPhone mit Tapatalk
Raspberry Pi mit FHEM, CUL, Signalduino, MySensors, HomeBridge, Presence, WifiLight2, Bravia, ...