Jump to content

Shut Down Process On Another Server


The Little Guy

Recommended Posts

I have 2 servers, one has multiple processes running, and the other has the control panel.

 

on the control panel, I would like to send a command to the other server. the command looks like this:

kill #

 

Where # is the number of the process id.

 

is there any way for me to send a command to that server to shut down that process?

Link to comment
Share on other sites

You can't simply send the password as the next command, you would need to setup ssh keys (google it). Also note that having root be able to login via ssh poses quite the security risk.

 

Once your keys are setup you would simply use....

 

exec("ssh username@servername commandtoexecute");

Link to comment
Share on other sites

When I use Cygwin, If I type in:

 

ssh username@servername I don't need a password, but if I do ssh servername it asks for a username and a password...

 

Is your username in cygwin the same as the one you are pre-pending to the servername in example 1?

Link to comment
Share on other sites

What testing have you done? We could go back and forth all day with this lack of information.

 

Test to see if your connection is successful by doing something simpler. eg;

 

exec("ssh ryannaddyps@myserver.com touch foo");

 

Does this make a file called 'foo' within the user ryannaddyps's home directory on the myserver.com machine?

Link to comment
Share on other sites

OK, I just opened putty, and tried it in there, connecting to:

ryannaddyps@myserver.com

 

and it asked for a password...

 

Does this mean that the key think isn't working for passwordless logins?

 

I'm not sure how keys work with putty. Besides, are you ryannaddyps?

Link to comment
Share on other sites

Your correct I didn't set it up correctly :)

 

I was reading my wiki and it said to create it on my home computer, which I did, but then I thought and realized that I wasn't connecting via my home computer, it was via another web server.

 

so I did it in putty on the websites server where the script runs, and did the process the same..

 

now it creates a file called foo!

 

Now I wan't to see if it does what I meant for it to do.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.