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
Related
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.
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.
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
My desire:
ssh into a remote machine, take a peak around, and then copy a file from from that remote machine into my local machine using a Linux command.
My frustration:
From what I've seen in the documentation, I can't be ssh'd while using the scp command. I must simply be a user on my local machine and specify the the connection info and the file location (ie. scp user#remotehost:copyFrom.txt /myDir/copyHere.txt).
I could alternatively use SFTP:
$ SFTP user#remotehost
$ $ get remoteFile.txt /myLocalDir/localFile.txt
but SFTP isn't quite as fast as SSH.
Is it possible to use scp while already sshd into the remote machine?
No, it is not possible, if you don't have public IP and sshd server running on your workstation (if you have, there is nothing easier than to run scp file localmachine: from remote session).
The speed is not significant. It can be one or two percent on large files, but using sftp, you will gain much more, because you do not have to initiate ssh the connection for each scp command, but only once and every get command is "cheaper". For normal files over normal network you will not notice difference.
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 8 years ago.
Improve this question
We have Linux server run java application,this morning the server did not response for the ssh connection.when I ssh -v, it shows " connection refused by remote host ".We also have a vnc server run in that Linux and it does not work either.But the ftp server is ok in that server,we can upload file into the server.In the end,we did not found a way to remote connect to the system.
After we reboot the computer on site,the ssh server is working again.But We did not found a clue why ssh is not working? Have someone ever met ssh hang problem like this? Which file should we look into?How to prevent ssh hang? Thanks in advanced.
added:
I check the log from secure.log.it states many failed attemps like following and i check the ipaddress is not ours:
Feb 23 04:13:30 localhost sshd[1276]: Failed password for invalid user mantis from 112.78.127.235 port 57140 ssh2
It seems like the attacker is trying to login into my server all the time until our ssh service is not responding.
SSH probably didn't "hang". The "Connection refused" response implies that no application was listening for incoming connections on the SSH port. It is most likely that the SSH service had died.
Check the log files. There is a good chance that there are clues in the logs (somewhere) to help explain what had happened.
If the logs don't give a definite explanation, I'd be considering the possibility that your server had been hacked ...
This sounds more like a firewall issue, either on the box itself or somewhere else in the network. You can verify that ssh is running and listening with netstat -ta | grep :22. If it is not, it indeed is a problem with SSH itself.
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.