1

How can I execute a process on a remote machine running Linux without SSH. Since the machine is scheduled to PXE-boot periodically, the SSH key will be changed and executing a process through a script using SSH is ruled out. Any idea on how it can be done?

PersonalNexus
  • 292
  • 2
  • 11
indiws
  • 11
  • 1
  • 2

6 Answers6

4

Regular re-installing via pxe does not preclude the use of ssh.

I don't know what distro you're using but it could be trivial to have the pxe install add public halves of ssh keys to the system's authorized_keys file. (I'm most familiar with Red Hat / Fedora and I always do this with my pxe setups.)

rsaw
  • 253
  • 2
  • 5
0

ssh would be safest with keys in place; but you can setup a webserver on remote box and execute commands by sending them to some php or cgi script that will then run command for you. why is ssh a problem? What kind of command are you running?

Hrvoje Špoljar
  • 5,162
  • 25
  • 42
0

Crontab will help you. Add your script in crontab that will automatically run your script.

Sandeep
  • 111
  • 3
  • If the process must be execute every time the machine starts, the solution suggests by Sandeep is perfect. – lg. Feb 27 '12 at 09:26
0

If your SSH problem related to SSH keys known_hosts file, you can disable host key verification. Have a look at this post. However, you need to be sure that you are safe from MITM attack.

A web interface can be created to execute the command, but you need to grant the web server process user the enough permissions to execute the needed commands (possibly using sudoers).

Khaled
  • 35,688
  • 8
  • 69
  • 98
0

What about using /etc/rc.d/rc.local file? This is executed at boot time.

0

To answer your question, install a salt minion and have it delete the master public key upon every reboot. The salt master could be set to autosign that minion. They will renegotiate keys automatically, then the minion will be up on the event bus ready for command after every reboot.

Not fair being 2017 (salt did not exist in 2012), but I was just wondering if I could live without SaltStack again... replace with Jenkins slave? Nope! Totally different thing--Jenkins slaves will NOT run remote commands for you...

Richard
  • 121
  • 3