238 reputation
216
bio website bharath.lohray.com
location Vista, CA
age 30
visits member for 3 years, 6 months
seen Dec 10 at 22:20

...


Apr
12
comment Run a script as root from apache
More observation: using php passthru ("ls -al"); works fine, but sudo ls -al does not return anything from that line. The rest of the script works fine. apache error log has the message sudo: sorry, you must have a tty to run sudo for each attempted sudo.
Apr
12
revised Run a script as root from apache
edited tags
Apr
12
comment Run a script as root from apache
I had incron working for a while. It restarted dnsmasq a few times on changing the hosts file - I could see the results in ps aux and the /var/log/cron, but after a while, it stopped responding to changes in the hosts file. incrond was still running (visible in ps aux) and requests to reload user tables (incrontab -d) did show up on the log. The only way to get incrond to respond again for a short while was to restart it :-( Any tips on getting around this?
Apr
12
comment Run a script as root from apache
I tried your solution. I wrote a script that had sudo service dnsmasq restart when I execute this script as sudo -u apache restartScript, it restarts the service fine. However, when I restart it from the browser, it does not work :-( running whoami returns apache, but the service restart fails :-( I wrote a C program that behaves the exact same way. What could be wrong?
Apr
11
comment EC2 login as EC2 user other than root
I discovered that is is essential to enable root login on instance storage instances as there is no way to fix anything if one is locked out! Worst - I once messed my sudoers file and had to terminate the instance. stackoverflow.com/a/4336527/482176 is a good answer too.
Apr
11
comment Browser does not render phpinfo()
I will have to wait for 2 days to mark my own answer correct.
Apr
11
awarded  Teacher
Apr
10
answered Browser does not render phpinfo()
Apr
10
comment Browser does not render phpinfo()
I see a blank page. And on checking for the source, I see some incomplete HTML. I also tried to check it from my phone and do not see any HTML rendering.
Apr
10
asked Browser does not render phpinfo()
Apr
10
comment Run a script as root from apache
Good idea. The thought of providing passwordless su access for just a single script had not occurred to me - lack of experience I recon.
Apr
10
comment Run a script as root from apache
Well, I could not sudo yum install it. Had to compile and install it. Make put he binaries in wired places that did not exists and are not in the PATH!
Apr
10
accepted Run a script as root from apache
Apr
9
comment Run a script as root from apache
Any idea if I can install it on an EC2 instance without compiling it from source ?
Apr
9
comment Run a script as root from apache
@MadHatter - Would it be a security risk? Couldn't anyone get root access by ticking apache into executing sudo bash?
Apr
9
asked Run a script as root from apache
Apr
9
accepted Running dnsmasq as an authoritative DNS server
Apr
9
comment Running dnsmasq as an authoritative DNS server
Thanks :-) I was not only reading imaginary things, I also had some of my DNS concepts messed up! I did not have an A record for h.lohray.com - I thought it was just meant for web servers! I now have an A record for ns1.h.lohray.com pointing to the IP of my AWS instance running dnsmasq, and an NS record for h.lohray.com pointing to ns1.h.lohray.com. And my browser is resolving it right!
Apr
9
comment Running dnsmasq as an authoritative DNS server
Oh! I am sorry :-(. I think I read whatever was on my mind than what was on the screen :-( My shortcoming. When I query 50.19.103.190 for i7.h.lohray.com, I get the right IP. I am still to figure out how to get the dnsmasq to resolve right. - Thank you.
Apr
8
awarded  Commentator