LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   (automatic) excution of a program in /usr/sbin as normal user (https://www.linuxquestions.org/questions/linux-software-2/automatic-excution-of-a-program-in-usr-sbin-as-normal-user-4175458774/)

273 04-24-2013 04:15 AM

Did you try adding the commands to /etc/rc.local as the link suggested? I'm not sure why that would be different to /etc/init.d/ scripts but it's worth a try?

JZL240I-U 04-24-2013 04:20 AM

SuSE hasn't got a rc.local, so I couldn't try that.

chrism01 04-24-2013 08:01 AM

Re suid on scripts; I knew that but from post #9 it looked like powertop is a cpp thus binary exe.

Maybe its different for you, but normally the boot process has to run as root to do all the privileged things it needs to do, although some sub-processes may be run as a different user for their own reasons.

On eg RHEL, you'd have have an entry in /etc/rc.d/rc.local like
Code:

su - user -c "cmd args"
This syntax means no passwd or sudo reqd.

JZL240I-U 04-25-2013 02:50 AM

I found out what SuSE did to rc.local ;), since Google is my friend :D. They created an "/etc/init.d/after.local", a "script with local commands to be executed from init after all scripts of a runlevel have been executed". I appended

Code:

su - root -c /etc/init.d/<my-script>
It still does not work *sigh*.

Quote:

Originally Posted by chrism01 (Post 4937955)
Re suid on scripts; I knew that but from post #9 it looked like powertop is a cpp thus binary exe.

It is an (interactive) binary. I took it's output and pasted it into a shellscript. That is what we are talking about in the meantime ;).

Quote:

Originally Posted by chrism01 (Post 4937955)
Maybe its different for you, but normally the boot process has to run as root to do all the privileged things it needs to do, although some sub-processes may be run as a different user for their own reasons.

Booting openSuSE is done by "systemd", not anymore by sysvinit. I don't know how "systemd" handles users and permissions.

Quote:

Originally Posted by chrism01 (Post 4937955)
On eg RHEL, you'd have have an entry in /etc/rc.d/rc.local like
Code:

su - root -c "cmd args"
This syntax means no passwd or sudo reqd.

I know that according to the man page of su the above entered "root" is redundant, but neither a simple "-" nor "- root" works. <edit1> A change of the command to

Code:

su - root -c "cmd >> /home/me/error.txt 2>&1"
brought no further insights either. Grrr. </edit1>

<edit2> Found out why: "su" is asking for a password. I created a test-script and ran that from console. [enter favourite expletives here]. What now?

sundialsvcs 04-25-2013 08:15 AM

There is nothing "magical" about the /usr/sbin directory ...

JZL240I-U 04-25-2013 08:48 AM

Thanks for stating the obvious :). Do you also propose a solution for the Problem?


All times are GMT -5. The time now is 06:40 AM.