Hello,
I'm a little confused with regards to the scripts in init.d. In which context are they executed?
I have a script with some commands. I cannot execute those commands from shell as user, but only as root. The script however seems to work fine once put into init.d.
Googled for it but found contradicting answers here as well. Some claim the context for init.d is root, others say su is needed. It seems the majority thinks that init.d is owned and executed by root, but still I would be glad if someone could clarify this.
Then again, the script used here http://wiki.amahi.org/index.php/Mount_Shares_Locally requires an input file with root credentials - why?
Thanks,
jayrock
User context for init.d scripts
Re: User context for init.d scripts
I think the /etc/init.d/* should be owned by root. You _can_ however run them in the sudo context if your privileges are sufficient. It might be sufficient to have them owned by a normal user but with the setuid bit set to root, I'm not sure.
could you post your script so we can analyse why it's failing for a normal useraccount?
could you post your script so we can analyse why it's failing for a normal useraccount?
echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D2173656C7572206968616D41snlbxq' | dc
Galileo - HP Proliant ML110 G6 quad core Xeon 2.4GHz, 4GB RAM, 2x750GB RAID1 + 2x1TB RAID1 HDD
Galileo - HP Proliant ML110 G6 quad core Xeon 2.4GHz, 4GB RAM, 2x750GB RAID1 + 2x1TB RAID1 HDD
Re: User context for init.d scripts
Thanks for your quick response, it's absolutely fine for me that init.d scripts run as root, I just to want be sure I understand what's going on.
One script is actually posted here, it's "hdparm" that requires the user to be root. As mentioned the script runs fine so no problem. http://forums.amahi.org/viewtopic.php?p=11679#p11679
The other one is a Ruby program that calls an ICMP ping procedure (and others) which requires root. Again, no promblem here, just want be sure about what I'm doing. See here: http://forums.amahi.org/viewtopic.php?p=11632#p11632
So to conclude, for now I assume that when I test the program / script as root, it will behave exactly as when it's started via init.d
Leaves the question open, why does http://wiki.amahi.org/index.php/Mount_Shares_Locally require root credentials to be supplied?
Cheers,
jayrock
One script is actually posted here, it's "hdparm" that requires the user to be root. As mentioned the script runs fine so no problem. http://forums.amahi.org/viewtopic.php?p=11679#p11679
The other one is a Ruby program that calls an ICMP ping procedure (and others) which requires root. Again, no promblem here, just want be sure about what I'm doing. See here: http://forums.amahi.org/viewtopic.php?p=11632#p11632
So to conclude, for now I assume that when I test the program / script as root, it will behave exactly as when it's started via init.d
Leaves the question open, why does http://wiki.amahi.org/index.php/Mount_Shares_Locally require root credentials to be supplied?
Cheers,
jayrock
Re: User context for init.d scripts
I haven't looked at the code for the mount_shares_locally script, but since it needs to mount file systems, it would need root permissions to do that.
Re: User context for init.d scripts
Well, yes - but that's the whole point, as a script in init.d it has root permission anyway. Maybe it wouldnt need the supplied credentials then. It's just a bit confusing.
Who is online
Users browsing this forum: No registered users and 51 guests