Unable to SSH into the FS switch - linux

I am trying to SSH into an FS switch remotely and I am getting the below error.
Unable to negotiate with 10.7.0.15 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1
To resolve this error. I have added a few lines in the following directory /etc/ssh/ssh_config
Host *
KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group14-sha1
PubkeyAcceptedKeyTypes=+ssh-dss
I have received this error.
Unable to negotiate with 10.7.0.15 port 22: no matching host key type found. Their offer: ssh-dss

Related

Basic SSH Connection using Paramiko fails

I'm learning the basics on paramiko and for that purpose I setup a basic lab where I connect an Ubuntu VM to a router emulated in EVE-ng.
The first step was to generate a key pair in the client via ssh-Keygen
Next I loaded the public key to the remote server (the Cisco router) using the following command:
ip ssh pubkey-chain
username administrator
key-hash ssh-rsa 97D0E9B5630D05D78EA9531053124BFF
Right after that I was able to login to the Cisco router from the Ubuntu VM:
$ ssh administrator#192.168.1.1
7206_1.rt#
Then, from the same client I started a Python shell session and tried to establish an SSH session using Paramiko:
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('192.168.1.1', username='administrator', password='password', key_filename= '/home/administrator/.ssh/id_rsa.pub')
But this time I got the following exception:
Exception: Illegal info request from server
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/paramiko/transport.py", line 2109, in run
handler(self.auth_handler, m)
File "/usr/local/lib/python3.8/dist-packages/paramiko/auth_handler.py", line 661, in _parse_userauth_info_request
raise SSHException("Illegal info request from server")
paramiko.ssh_exception.SSHException: Illegal info request from server
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/dist-packages/paramiko/client.py", line 435, in connect
self._auth(
File "/usr/local/lib/python3.8/dist-packages/paramiko/client.py", line 764, in _auth
raise saved_exception
File "/usr/local/lib/python3.8/dist-packages/paramiko/client.py", line 751, in _auth
self._transport.auth_password(username, password)
File "/usr/local/lib/python3.8/dist-packages/paramiko/transport.py", line 1498, in auth_password
raise SSHException("No existing session")
paramiko.ssh_exception.SSHException: No existing session
The remote router SSH debug shows that authentication failed:
*Aug 16 01:18:07.295: SSH2 0: MAC compared for #5 :ok
*Aug 16 01:18:07.299: SSH2 0: input: padlength 16 bytes
*Aug 16 01:18:07.299: SSH2 0: Using method = publickey
*Aug 16 01:18:07.307: SSH2 0: send:packet of length 432 (length also includes padlen of 4)
*Aug 16 01:18:07.307: SSH2 0: computed MAC for sequence no.#5 type 60
*Aug 16 01:18:07.311: SSH2 0: Authenticating 'administrator' with method: publickey
*Aug 16 01:18:07.327: SSH2 0: SSH ERROR closing the connection
*Aug 16 01:18:07.331: SSH2 0: send:packet of length 80 (length also includes padlen of 15)
*Aug 16 01:18:07.331: SSH2 0: computed MAC for sequence no.#6 type 1
*Aug 16 01:18:07.335: SSH2 0: Pubkey Authentication failed for user administrator
*Aug 16 01:18:07.335: SSH0: password authentication failed for administrator
At this point I can't tell whether the issue is in the server or in the router as all works fine when connecting directly from server to router without Paramiko.
Thanks.
Ok, looks like by default, Paramiko searches for discoverable private key files in ~/.ssh/ that's fine if trying to connect to another server, but since it's trying to reach a router, this feature needs to be disabled by setting look_for_keys to False. That fixed the issue (as long as this is not a production environment) which is my case.
In case it helps anyone else, I was receiving this same "Illegal info request from server" error because the password being used had a flag on it that it needed to be updated. I only saw this when logging in manually via WinSCP.
Authentication is done via public key at /home/administrator/.ssh/id_rsa.pub
Not quite: it is done using the private key of the local user you are using when typing:
ssh administrator#192.168.1.1
'administrator' is the name of the remote account used to open a session on the remote server 192.168.1.1
The authentication, on the remote side, will be done using ~administrator/.ssh/authorized_keys (again, on the remote machine), to check if the local ~/.ssh/id_rsa.pub public key was properly registered in the remote ~administrator/.ssh/authorized_keys.
Your local account might be also 'administrator', but that same local account might not be the same when executing the Python shell.
When you see
Authenticating 'administrator' with method: publickey
SSH is talking of the remote 'administrator' account on the remote server, irrespective of the local user account you are in.

ssh command is not working while connecting linux to solaris

I am trying to connect to remote solaris machine from a linux server using ssh but not able to connect to the solaris machine. I am using below ssd command to connect to the solaris machine
ssh <host_name>
After giving this command, I am not getting any prompt for username and password. Is it the limitation for linux to solaris connection ??
The output is:
root#host> ssh -v user#solaris_host
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to solaris_host [solaris_host] port 22.
debug1: connect to address solaris_host port 22: Connection timed out
ssh: connect to host solaris_host port 22: Connection timed out
Go over following steps
Check the network connectivity with your target, e.g. ping.
Check if the port 22 is open on your remote host e.g. nmap -A 192.168.0.5/32 -p 22
Check if ssh daemon is running on your target svcs ssh
Come back, when the problem still exists.

Getting Connection refused error when using scp on VM

I have a virtual linux build running on qemu (It runs drop bear as ssh client.) and I am trying to copy some modules I wrote to it using scp using the following command:
scp -vvv -p 2222 wd/day10/int_mod.ko root#localhost:/lib/modules/3.13.5/int_mod.ko
And I get Connection refused error more specifically (I forwarded 2222 to 22 of virtual machine.):
Executing: program /usr/bin/ssh host localhost, user root, command scp -v -p -d -t /lib/modules/3.13.5/int_mod.ko
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: connect to address 127.0.0.1 port 22: Connection refused
ssh: connect to host localhost port 22: Connection refused
lost connection
What I don't understand is I can easily connect to ssh using
ssh -p 2222 root#localhost
I can connect without any problem.
ssh and scp use different options for specifying the port. From the ssh man page:
[-p port]
From the scp man page:
[-P port]
scp uses capital P. Notice how your debug output says port 22 connection refused when you are trying to connect to port 2222.
Problem is that , ssh package is not installed completely!
you must install ssh and openssh-client so on... with Synaptic Package Manager!
in Synaptic Package Manager , first type ssh in search filter and mark ssh. then click on Apply Button to install ssh services for server and client.
by this way your problem will fixed 100 Percentage!!!
see bellow Please:

Can't connect to noVNC server

I have used git to get the noVNC repository from github.
I started server with ./utils/launch.sh --vnc localhost:5901. After that I typed url (received in my console) in browser.
http://user.local:6080/vnc.html?host=user.local&port=6080 (I have replaced actual user name).
But when I visit this url and enter user.local and port 6080 I get:
27: 10.1.0.164: Plain non-SSL (ws://) WebSocket connection
27: 10.1.0.164: Version hybi-13, base64: 'False'
27: 10.1.0.164: Path: '/websockify'
27: connecting to: localhost:5901
27: handler exception: [Errno 61] Connection refused
Should I start something else?
I think you need to generate a certificate for connecting a websocket: https://github.com/kanaka/websockify/wiki/Encrypted-Connections

Unsuccessful connection on ssh to the subordinate nodes of a cluster

Executing start of services on the subordinate nodes of a cluster by means of the following command:
hadoop#one:/export/hadoop-1.0.1/bin$. ./start-all.sh
not the first time I receive result
starting namenode, logging to /export/hadoop-1.0.1/libexec/../logs/hadoop--namenode-one.out
192.168.1.10: starting datanode, logging to /export/hadoop-1.0.1/libexec/../logs/hadoop-hadoop-datanode-myhost2.out
192.168.1.11: ssh: connect to host 192.168.1.11 port 22: Connection timed out
192.168.1.5: starting secondarynamenode, logging to /export/hadoop-1.0.1/libexec/../logs/hadoop-hadoop-secondarynamenode-one.out
starting jobtracker, logging to /export/hadoop-1.0.1/libexec/../logs/hadoop--jobtracker-one.out
192.168.1.10: starting tasktracker, logging to /export/hadoop-1.0.1/libexec/../logs/hadoop-hadoop-myhost2.out
192.168.1.11: ssh: connect to host 192.168.1.11 port 22: Connection timed out
How do I fix the error below:
ssh: connect to host port 22: Connection timed out
hadoop#one: /export/hadoop-1.0.1/bin$ ssh -vvv 192.168.1.10
Sun_SSH_1.5, SSH protocols 1.5/2.0, OpenSSL 0x1000004f
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Rhosts Authentication disabled, originating port will not be trusted.
debug1: ssh_connect: needpriv 0
debug1: Connecting to 192.168.1.10 [192.168.1.10] port 22
debug1: connect to address 192.168.1.10 port 22: Connection timed out
ssh: connect to host 192.168.1.10 port 22: Connection timed out
What to do to correct an error?
Do you have sshd daemon running on your machine? Your OS might come with ssh, but in order to start sshd daemon, you need to install ssh completely. By complete I mean :
ssh : The command we use to connect to remote machines - the client.
sshd : The daemon that runs on the server and allows clients to
connect to this server.
Also, make sure there is no issue with port 22. If you still face some issue try ssh with -v switch to get the complete trace.
ssh -v myhost2
You can go here for a detailed explanation of ssh.

Resources