I am using a Windows machine and I connect to my remote host via a jump host using a SSH software (I use mobaxterm for now). Now my login process is like this:

  1. Load the jump host session I have saved in mobaxterm (I have set up the ip, port, user name and passwd for the jump host)

  2. Now I am in the jump host. I am prompted to select a server group. I enter a given number and press Enter key.

  3. I am prompted again to select a server. I enter another given number and press Enter key. Now I am on the remote server but with another user name.

  4. I use su - $MYUSERNAME command to switch account and I am prompted to enter my passwd for the remote host. After entering my passwd and press Enter key, I login into my own account in the remote host, finally!

Every time I open a new session in mobaxterm. I have to repeat the above process, which is rather boring and tedious. Are are there better ways in which I can automate this process so I can login into my final account without having to input these info every time?

  • If the jump host is giving a menu, you are doing it wrong. Try to use SSH keys – Rui F Ribeiro Sep 9 '18 at 10:50
  • I do not know details. But the jump host is configured to give you a list and then accept your input. After input the group and server number, you can get to the remote server. – jdhao Sep 9 '18 at 11:07
  • I use and setup regularly jumphosts. That setup does not seem conducive to try to automate tasks done concurrently in several servers at a time. I would bring that issue with whoever is taking care of it. – Rui F Ribeiro Sep 9 '18 at 11:12
  • Use GUI ssh clients with expect auto login support, if you have excess to Linux or CYGWIN , create a expect script to do so – Bharat Sep 9 '18 at 12:24
  • If step 2. is a graphical interaction, then perhaps you can use a tool like autoit to "click" for you, otherwise mobaxterm says it has a "plugin" with the expect command (tcl,...) that typically is used for this sort of login. You might find more existing answers on stackoverflow, such as this one. – meuh Sep 9 '18 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.