SSH Tunnel Issue [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I'm trying to tunnel to a remote VM.
I previously used the below command:
ssh -N -p 22 username#1.2.3.4 -o StrictHostKeyChecking=no -L 127.0.0.1:8080:5.6.7.8:443
Something went wrong with the server at the weekend and the SA had to restore the image.
Now when I try to do this I get prompted with the following:
Permission denied, please try again.
username#1.2.3.4's password:
I don't know what this password should be and the SA isn't available.
I am able to ssh directly onto 1.2.3.4 using my public key and when on it I can ssh onto 5.6.7.8 with this command:
ssh -A blueboxadmin#5.6.7.8
Is there any way I can use this to tunnel right through. Failing that, is there anything I can setup on 1.2.3.4 that will allow me to tunnel through?

Looks like the ssh key value pair is missing from the remote server.
You will have to copy the entry of you server ssh key (from $HOME/.ssh/id_rsa.pub file) into the remote server's $HOME/.ssh/authorized_keys file. Make sure the key is pasted in a single line. After doing this, you should be able to connect.

Related

Permission to access another remote server Linux, Ubuntu [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
How can I allow a remote server to run a command without asking for password and any confirmation.
I use this command but it asks for password,
ssh root#0.0.0.0 /var/workingproject/notify
is there a way I can whitelist a remote server to access my server and execute a command without asking for password?
You can add your public key, generally found on your local box at ~/.ssh/id_rsa.pub to your remote server's authorized keys file. To do it automatically, you could use something like this:
ssh-copy-id -i ~/.ssh/id_rsa.pub root#0.0.0.0
Or alternatively, you can open the remote authorized keys file (~/.ssh/authorized_keys) and add your public key directly.
If you do not have a public key configured on your local instance, you can run:
ssh-keygen
to create one.

SSH connect to remote on local network [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 6 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I have 2 computers on linux (ubuntu like), both are on separated local networks (192.168.xxx.xxx).
I would like to connect through ssh to Linux2 from Linux1 but it doesn't have any public IP.
I have also a public server (srv.domain.com)
I suppose that both PC could connect to server and it would be able to forward commands ??
But I can't figure out how to do that. Is someone already did something similar and can explain it to me.
I have root access on all machines
Thanks a lot for your help !!!
The easiest way would be to make the firewall/router allow ssh connections between the hosts. But there is another way:
If your server can reach both clients, you can ssh onto the server and redirect a port to the ssh on the other machine:
ssh -L 1234:CLIENT2:22 -l USERNAME SERVERNAME
after logging into the the machine open another terminal window and enter:
ssh -l USERNAME -p 1234 localhost
USERNAME should be replaced with the username on the server/second
client.
CLIENT2 should be replaced by the ip or hostname of the
second client.
SERVERNAME should be replaces by the name of your
server.
You can also ssh onto the server and open another ssh session from there. But that would be to easy ;)
If your server cannot reach the clients you have to build the tunnel the other way round:
ssh -R 1234:22 -l USERNAME SERVERNAME
after logging into the the machine open a terminal window on the other machine and enter:
ssh -l USERNAME -p 1234 SERVERNAME
USERNAME should be replaced with the username on the server/second
client.
SERVERNAME should be replaces by the name of your
server.

Configure server SSH for remote access [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I'm a complete begginer in Linux, especially in Linux for servers. I just installer Ubuntu in a server and now I'm trying to configure SSH for remote access.
I installed openssh-server and then did ufw allow 22.
Now when I do ssh username#XXX.XXX.X.XXX in another computer it says that the remote host identification was changed.
I did some research and found this tutorial, but I don't know if it is what I need.
I just want to configure the SSH access to the server.
Can anyone help me?
During SSH request the server presents its id to clien which the client stores along with the host name/IP of the server as known hosts.
When the ID(key) of the server changes(may be due to intallation of ssh server, ip address change, etc), the SSH request fails as the server ID stored in known_hosts is different from the one presented now. This is what has happened.
If you have not made any changes to the server and this happens beware it might indicate a man-in-middle attack where the attacker is trying to snoop you connection to server.
To fix this you need to remove a entry in known_hosts file.
ssh-keygen -R <hostname/IP>
If you are unsure about your client hostname you can just delete the known_hosts file using
rm ~/.ssh/known_hosts

Is it possible to chain from one terminal to another via SSH in one series of commands in linux? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I am attempting to set up an alias to get from my local box into our main server and then subsequently into an internal box. I'm setting up RSA keys to make this fast, but it would be really nice if I can alias the whole operation to a single short command. Split into parts, it would be two steps:
local> ssh x.x.x.x
x.x.x.x> ssh y.y.y.y
y.y.y.y>
I would prefer to use an alias "sshtoy" that accomplish both of these in one go, but I don't know how to chain these together. And with the RSA keys in place, I would magically end up on internal server y without all the typing. Any ideas? Can this be done?
Okay. This one was pretty easy to find. Due diligence...
ssh -A -t server1 ssh -A -t server2 ssh -A server3
This will allow you to chain transparently from one server to the next, entering passwords as you go for each. With RSA keys set up and no passwords, you end up at server3 right away. To put this in an alias, you'd add the following to your ".bashrc" file.
alias sshto3="ssh -A -t server1 ssh -A -t server2 ssh -A server3"
Hope this helps someone.

ssh, how to specify a key file which is on another machine? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I need to ssh to a remote host 2 when I am "sshed" in other remote machine (remote host 1). For example, from remote host1 I need to execute:
ssh -i MY_PRIVATE_KEY_FILE_NAME myname#remotehost2
However, my private key file is on my local machine. How can I specify it?
You can use ssh agent to forward your local key.
Start your agent (should be already installed) with
ssh-agent
then add your local key
ssh-add /path/to/your/keyfile.key
then login to serverA
ssh -A userA#serverA
Now you should be able to login at serverB with you local key.
Options:
scp the key to remote host 1
Copy the key manually, i.e. copy locally, open an editor on remote host 1, paste, save.
Connect to remote host 2 from a different local terminal (or drop the connection in the one you're on)
Set up ssh forwarding. I believe it would be something like ssh -R 12345:remotehost2:22 user#remotehost1, then from local ssh -p 12345 user#remotehost1. Note that user in the second command is the username for remotehost2, despite apparently connecting to 1.

Resources