Skip to main content
typo-fix
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 264

First of, like the other respondents, I recommend just using ssh keys. But I will assume that the person controlling the server is simply not going to allow you to use ssh key authentication and you must use password authentication.

You can use ControlMaster and ControlPath.

Let A be the server that you wontwon't have access to (think continuous integration server like Bamboo) and C be the remote host running Ubuntu.

Now let B be some computer that you control. If you can not provide a suitable B computer, this answer will not work.

  1. Create a key pair and add the public part to B's authorized_keys file. Give A the private key. Now you can log into B from A without a password.
  2. On B manually ssh -M -S /tmp/controlpath C and enter your password at the prompt. After that you should be able to log into C from A without a password ssh -S /tmp/controlpath C.

In the script on A you can write ssh B ssh C dostuff.

Every time you reboot B, you will have to reestablish the connection ssh -M -S /tmp/controlpath C.

First of, like the other respondents, I recommend just using ssh keys. But I will assume that the person controlling the server is simply not going to allow you to use ssh key authentication and you must use password authentication.

You can use ControlMaster and ControlPath.

Let A be the server that you wont have access to (think continuous integration server like Bamboo) and C be the remote host running Ubuntu.

Now let B be some computer that you control. If you can not provide a suitable B computer, this answer will not work.

  1. Create a key pair and add the public part to B's authorized_keys file. Give A the private key. Now you can log into B from A without a password.
  2. On B manually ssh -M -S /tmp/controlpath C and enter your password at the prompt. After that you should be able to log into C from A without a password ssh -S /tmp/controlpath C

In the script on A you can write ssh B ssh C dostuff.

Every time you reboot B, you will have to reestablish the connection ssh -M -S /tmp/controlpath C

First of, like the other respondents, I recommend just using ssh keys. But I will assume that the person controlling the server is simply not going to allow you to use ssh key authentication and you must use password authentication.

You can use ControlMaster and ControlPath.

Let A be the server that you won't have access to (think continuous integration server like Bamboo) and C be the remote host running Ubuntu.

Now let B be some computer that you control. If you can not provide a suitable B computer, this answer will not work.

  1. Create a key pair and add the public part to B's authorized_keys file. Give A the private key. Now you can log into B from A without a password.
  2. On B manually ssh -M -S /tmp/controlpath C and enter your password at the prompt. After that you should be able to log into C from A without a password ssh -S /tmp/controlpath C.

In the script on A you can write ssh B ssh C dostuff.

Every time you reboot B, you will have to reestablish the connection ssh -M -S /tmp/controlpath C.

deleted 34 characters in body
Source Link
emory
  • 472
  • 2
  • 8

First of, like the other respondents, I recommend just using ssh keys. But I will assume that the person controlling the server is simply not going to allow you to use ssh key authentication and you must use password authentication.

You can use ControlMaster and ControlPath.

Let A be the server that you wont have access to (think continuous integration server like Bamboo) and C be the remote host running Ubuntu.

Now let B be some computer that you control. If you can not provide a suitable B computer, this answer will not work.

  1. Create a key pair and add the public part to B's authorized_keys file. Give A the private key. Now you can log into B from A without a password.
  2. On B manually ssh -M -S /tmp/controlpath C and enter your password at the prompt. After that you should be able to log into C from A without a password ssh -S /tmp/controlpath C

In the script on A you can write ssh B ssh C dostuff. To make it more secure, you can

Every time you reboot B, you will have to reestablish the connection ssh -M -S /tmp/controlpath C

First of, like the other respondents, I recommend just using ssh keys. But I will assume that the person controlling the server is simply not going to allow you to use ssh key authentication and you must use password authentication.

You can use ControlMaster and ControlPath.

Let A be the server that you wont have access to (think continuous integration server like Bamboo) and C be the remote host running Ubuntu.

Now let B be some computer that you control. If you can not provide a suitable B computer, this answer will not work.

  1. Create a key pair and add the public part to B's authorized_keys file. Give A the private key. Now you can log into B from A without a password.
  2. On B manually ssh -M -S /tmp/controlpath C and enter your password at the prompt. After that you should be able to log into C from A without a password ssh -S /tmp/controlpath C

In the script on A you can write ssh B ssh C dostuff. To make it more secure, you can

Every time you reboot B, you will have to reestablish the connection ssh -M -S /tmp/controlpath C

First of, like the other respondents, I recommend just using ssh keys. But I will assume that the person controlling the server is simply not going to allow you to use ssh key authentication and you must use password authentication.

You can use ControlMaster and ControlPath.

Let A be the server that you wont have access to (think continuous integration server like Bamboo) and C be the remote host running Ubuntu.

Now let B be some computer that you control. If you can not provide a suitable B computer, this answer will not work.

  1. Create a key pair and add the public part to B's authorized_keys file. Give A the private key. Now you can log into B from A without a password.
  2. On B manually ssh -M -S /tmp/controlpath C and enter your password at the prompt. After that you should be able to log into C from A without a password ssh -S /tmp/controlpath C

In the script on A you can write ssh B ssh C dostuff.

Every time you reboot B, you will have to reestablish the connection ssh -M -S /tmp/controlpath C

Source Link
emory
  • 472
  • 2
  • 8

First of, like the other respondents, I recommend just using ssh keys. But I will assume that the person controlling the server is simply not going to allow you to use ssh key authentication and you must use password authentication.

You can use ControlMaster and ControlPath.

Let A be the server that you wont have access to (think continuous integration server like Bamboo) and C be the remote host running Ubuntu.

Now let B be some computer that you control. If you can not provide a suitable B computer, this answer will not work.

  1. Create a key pair and add the public part to B's authorized_keys file. Give A the private key. Now you can log into B from A without a password.
  2. On B manually ssh -M -S /tmp/controlpath C and enter your password at the prompt. After that you should be able to log into C from A without a password ssh -S /tmp/controlpath C

In the script on A you can write ssh B ssh C dostuff. To make it more secure, you can

Every time you reboot B, you will have to reestablish the connection ssh -M -S /tmp/controlpath C