[SOLVED] Running a process as apache, change to root ?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
You said "websites" plural, and that scares me.
If you have client websites running cgi scripts as the user apache then what I am about to suggest is probably a Bad idea.
But if you use suexe and each website runs their cgi scripts as their own user then this will work safely.
visudo and add the line;
Code:
apache ALL=(root) NOPASSWD: /usr/bin/ssh
Then in your post-commit script change the "ssh" command to "sudo ssh" and this should do the trick.
It would probably be better to find out why the user apache can't run ssh, if the user needs to be in a certain group, then discover that and place apache in that group.
Again, I would be careful giving rights to the user apache if there are other users running cgi as the user apache.
You said "websites" plural, and that scares me.
If you have client websites running cgi scripts as the user apache then what I am about to suggest is probably a Bad idea.
But if you use suexe and each website runs their cgi scripts as their own user then this will work safely.
visudo and add the line;
Code:
apache ALL=(root) NOPASSWD: /usr/bin/ssh
Then in your post-commit script change the "ssh" command to "sudo ssh" and this should do the trick.
It would probably be better to find out why the user apache can't run ssh, if the user needs to be in a certain group, then discover that and place apache in that group.
Again, I would be careful giving rights to the user apache if there are other users running cgi as the user apache.
Well that worked. Thank you very much !!! I can at least get the team back working. I know it is bad practice, I will troubleshoot how come apache couldn't login. Maybe I should create a user that will do this. Thank again. Note: it worked without the sudo.
If your are going to help, then help, otherwise...
I would like to help, but before I have to fully understand the issue
ssh is a program for login into a remote machine, it is like ftp but with encrypted connection...
It requires no root privileges to use it
Quote:
Originally Posted by rustek
He may be copying files with various owners and various permissions to the other box, so my answer to you is yes.
If I have password for an user in a remote ssh server, I can login without being that user
And any file I copy with ssh will belong to the remote user...
Anyway, in the end rbalaa succeed using ssh without using sudo (= without having root privileges), so the issue is elsewhere
If your are going to help, then help, otherwise...
Please be aware that asking questions is often the best way to start troubleshooting things or having something clarified. Asking prudent questions should never be met with such a reply. And I fully agree one should question having a non-human account run anything as root, especially if "it worked before without Sudo" which could point to misconfiguration on the OPs part.
Still not working. Don't ask me why, but it worked for sometime, and now its back. Anyhow you are right I should have explained the setup better. Yes, I wanted to SSH so that I can update our live server. Now after many frustrated hours, I decided to have both SVN and our live server on the same box.
I found a debug script online and this is what I get when post-commit runs:
well mark it as solved. the reason my connection kept breaking is because I never once listed my SVN repo from the local server (where svn is located). Soon as I did that, it asked me to accept (p). So I did and now it works. I also forgot to mention that the SVN server is running with HTTPS.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.