How can I execute a process in the remote machine running linux without ssh.Since the machine is scheduled to pxe boot periodically, ssh key will be changed and executing process through a script using ssh is ruled out.
Any idea on how it can be done?
Thanks
If your only problem with ssh is that you can't use key-based authentication, you don't have to rule out ssh entirely, you just have to automate a password-based authentication.
This project looks like it might be a good solution.
This should be more secure than http or telnet, as long as you keep your password and any files that contain it well guarded (which you would have to do with keys anyways).
You can do it via http, but I think this way is not safe.
For example, you can write a php script
<?php
if ($_SERVER['REMOTE_ADDR'] == '127.0.0.1')
system("./yourPrograme");
?>
How about telnet? It's not as secure as SSH though.
Related
I understand the issue but not sure how to fix it :(
Problem Story:
I've installed pageant in my windows10 and added ssh keys(keys generated through puttygen) into it. configured putty session in windows10 with agent forwarding to access the servers(linux) with out using typing/credentials.
whenever I open putty session to login to any server, putty talks to the pageant and load/used my credentials without my involvement to enter credentials,.
keys deployed to all over servers when I do ssh form one server to another server the pageant works fine and able to access,no issue at all untill paegent inactive....I'm happy till this part
when i use ssh in cron auto job, it unable to calls the keys from linux to pageant(win10).
how to make this to run in linux(cron)
Of course not, as the cron does not run in the context of your SSH session.
So it cannot talk to local Pageant.
Even if the cron knows what user did create the job, how could it know, which of potentially many SSH sessions, you have opened, it should query for the keys? And what, if you actually do not have any SSH session open? The cron job should work even, when you are not connected to the server.
You have to have the keys stored on the server, where cron runs. There's no other way around that.
I need to run shell commands on several servers. Is there a secure way to do this? Right now im thinking of exposing a php url that allows me to send pure script commands and let the web server spit out a json response. But this is a lot of work and doesnt sound like it will be very secure.
I want to run commands like "ping", "whois" and other network commands. Its about seeing connectivity between different servers. I.e. Server in germany can talk to the server in the us, etc
Use ssh. Read a good ssh tutorial. You want to use it with a public key (to avoid typing passwords).
Of course, you need to have an SSH server process running on the remote server machines.
Can anyone please tell me how I can write a bash shell script that executes another script on several remote machines without ssh.
The scenario is I've a couple of scripts that I should run on 100 Amazon Ec2 cloud instances. The naive approach is to write a script to scp both the source scripts to all the instances and then run them by doing a ssh on each instance. Is there a better way of doing this?
Thanks in advance.
If you just want to do stuff in parallel, you can use Parallel SSH or Cluster SSH. If you really don't want to use SSH, you can install a task queue system like celery. You could even go old school and just have a cron job that periodically checks a location in s3 and if the key exists, download the file and run it, though you have to be careful to only run it once. You can also use tools like Puppet and Chef if you're generally trying to manage a bunch of machines.
Another option is rsh, but be careful, it has security implications. See rsh vs. ssh.
I have a need to restart a CentOS service remotely via ssh during an automated, unattended process (executing a build on some software from a build server), but am unsure how to best implement security. Help is needed! ;-)
Environment:
Running an ssh login on a remote box, I want to execute on my server something like:
/sbin/service jetty restart.
The ssh call is being made during a maven build process (probably doesn't affect anything, really).
I want the ssh session to login with a user that has practically zero permissions on the server except to execute the above.
I can set up shared key access for the ssh session.
Thanks!
Good idea to use an ssh key. You can then use a 'forced command' for that particular key, so it won't be able to run any other commands. See http://www.eng.cam.ac.uk/help/jpmg/ssh/authorized_keys_howto.html
I usually use PuTTY to execute commands on a Linux machine. But I wish to make a webpage from where I can execute specific commands on a Linux machine by simple button clicks.
What are the various options available and what is the one that is easy to implement?
This depends on the kind of server you are running. But almost all servers have some kind of CGI support or an equivalent. Keep in mind that this can often cause a security issue.
I don't think you can and should try to embed script code in your page.
The best suggestion may be to hyperlink a script file and let the user get it from your server.
Just put that file on the server and then hyperlink it.
securewebcmd can do this for you
can use http or https
password protected
password not transmitted in clear, even using http (hashes the commandline with the password, and server does the same thing, using its copy of the password, and only runs the command, if the hashes match)
can queue commands, which run sequentially
can view results of any of the commands you've run earlier, even if you restart the server
uses nodejs: no dependency on any heavyweight server, ie no need for apache, jboss etc ...