ACPI als normaluser

  • Hallo z`samme!


    Ich möchte meinen VDR - Version 2 - als Normaluser betreiben, ergo müssen auch alle Scripte als Normaluser ausgeführt werden können. Für ACPI verwende ich folgendes Script in der shutdown.sh:



    Wenn ich die Befehle als root ausführe, funktioniert es. Wenn ich vor die befehle ein sudo stelle, arbeitet er Zeile für Zeile ab und verlangt jedesmal das root-passwort.


    Wie kann ich das als normaluser ausführen ausm VDR raus ?

    Gruss,
    Michael

    VDR2: Ubuntu 20.04.2 LTS, 5.4.0-66-generic x86_64, TT-S2 6400 DVB-S, VDR 2.4.x, TouchTFT. Plugins: remote,dvbhddevice,live,graphtft,epgsearch,extrecmenu,

  • google weiß doch alles ->


    http://www.google.de/search?q=sudo+im+script


    Reading the man page for sudo reveals that using the -S option reads the password from stdin, so `echo "password" | sudo -S whatever" should do your bidding.


    However, it's usually considered a bad idea to leave passwords in cleartext scripts. What you can do instead is use the SUID bit. Run `chmod 4711` on the file, then chown to root. That sets the permissions to execute by everyone, read by owner (root) only, but assume the identity of the owner when it is run. Make sure your program is relatively bomb-proof, unless security isn't a big deal where you work.

    yavdr 0.5, AMD Athlon(tm) II X2 240e, MSI 770-C45, 4GB, Cine S2, Terratec Cinergy S2 PCI HD, TechniSat SkyStar2 DVB-S, TechniSat AirStar2 DVB-T

  • Zitat

    Original von nippes
    What you can do instead is use the SUID bit. Run `chmod 4711` on the file, then chown to root.


    Nur funktioniert das üblicherweise nicht mit Shell-Skripten. Deshalb gibt es ja auch bei Debian basierten Distributionen ein Executable, das als Wrapper dient und das SUID-Bit gesetzt hat.


    Gerald


    HP Proliant MicroServer Gen8, Xeon E3-1230, 12 GB RAM, 3xWD red 2TB im RAID 5, 2xSundtek MediaTV Home DVB-C/T, L4M TWIN-C/T, Ubuntu Server 14.04.1, Plex Media Server
    Samsung UE55H6470

  • Wenn du das Script mit sudo startest, und die /etc/sudoers entsprechend editierst, sollte es doch funktionieren... ?

    VDR 1 (SD) : ASRock A330 GC, 1 GB RAM, TT- FF Karte rev. 2.3, 7'' TFT, Lirc X10 - Selbstbau Gehäuse - Suse 11.3 (64) vdr-1.7.10 diverse Plugins
    VDR 2 (HD) : MSI G41M-P25, 2 GB RAM, E6700 2x3.20GHz, Gainward GT220, 2TB HD, Lirc X10, TT S2-3600 USB, TT S2-1600, - Suse 11.3 (64) NvidiaTreiber 260.19 vdr-1.7.18 - xineliboutplugin 1.0.90 cvs, xine-lib 1.1.90 , s2-liplianin DVB Treiber

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!