ssh to Server from within a Shell Script
Hi!
How do we ssh to a server from within a Shell Script (Bash)? I have been trying to achieve it but it seems that ssh does not support stdin for password. I want to ssh to a particular server and execute some commands/scripts and then logout of it. I want to do it all from within a Shell Script so that I can add it to crontab. Any ideas? |
Hello,
The best and most secure way would be to set up key authentication to that remote server so that you don't have to provide a password. If you cannot (or don't want to) go that way (which is the most secure) you could use a tool like sshpass that can be used to pass on your password to ssh from within a script. Using sshpass your password will be visible in the script so limit access to the file/computer you're using it on or encrypt your script when you've found it functional. Kind regards, Eric |
The problem is resolved and is related to my other thread:
http://www.linuxquestions.org/questi...nd-ntp-873325/ |
Hi,
Glad you've got it solved and that you choose to use key authentication as a solution. Have fun with Linux. Kind regards, Eric |
All times are GMT -5. The time now is 09:40 AM. |