Linux - EnterpriseThis forum is for all items relating to using Linux in the Enterprise.
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.
I have automated the logins to a number of servers through the shell script.
But I am left with few since they are not connected directly in the sense I need to connect to a particular intermediate host and from there I need to login to the intender server.
All these servers are unix only. But I am not aware how to invoke a shell from intermediate host and connect the intended destination server.
Kind request to please provide assistance on the same asap.
Note:- As of now the script prompt for the passwords during login.
Please let me know in case if there is any way to encrypt the password and put the same in the script.
Thanks for your response.
I have not tried expect since the password would be visible. Is there any way in shell to do the same ?? If not, could you please provide a good link for teh expect script ?
I have browsed thru a few and was not able to find a good one where in the password could be encrypted.
expect lets you run arbitrary bash commands, so whatever method you are using to handle encrypted passwords in bash should be able to be extended to expect.
It is working fine. But once I get the password prompt I am not able to type anything there and the script is throwing me back.
When I tried to give the passwords and I was able to login to the destination machine through the intermediate server but again was not able to execute any commands.
Request to please check the above expect script and advice in case if I am missing somthing.
I would suggest to use an ssh-key to log in. Running an ssh agent in the background would even allow to connect to several machines after you entered the passphrase once.
Then an ssh tunnel created by the option -L could give you access to a secondary machine behind a gateway and by using agent forwarding the same already enabled ssh-key (something like: “ssh -L 1234:server2:22 server1 &” and then “ssh -p 1234 localhost”).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.