Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
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.
Can you help with this :
.....
I try to run in php script..
================
shell_exec("ssh admin@192.168.1.13 reboot");
===============
in php....I have put the key on server...
i can ssh server without a password..
i got "Could not create directory ssh... " error message from that php script...
if i did "ssh admin@192.168.15 reboot" from shell it works ok....
What how?
You should tell us what you want to do and we'll see how we can help.
But, if you want to use a webserver to run system commands, and you're absolutely sure about this (as it's a security risk), it's better to setup sudo for the user that runs the webserver. This way you can limit that user to run specific commands only.
What how?
You should tell us what you want to do and we'll see how we can help.
But, if you want to use a webserver to run system commands, and you're absolutely sure about this (as it's a security risk), it's better to setup sudo for the user that runs the webserver. This way you can limit that user to run specific commands only.
Regards
i want to run :
exec("ssh admin@192.168.1.13 reboot");
from my php script...but confuse with user problem ..
should i change the user at httpd.conf, the same with user i login ??
Yes, it's more easier to change the user that runs apache (I guess you run apache since you mentioned httpd.conf) and make it be admin. Of course this has to be a non-privileged user for security reasons.
Or you can create a public key for the current apache user and add it to ~/authorized.keys for admin at 192.168.1.13
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.