I tried to ssh a remote linux server with username and password on my Mac. But it shows the following mistake. It seems that it tries to login with rsa keys. But I want to login with password. (I can successfully login with password in Xshell in windows)
SSH command:
ssh -v -p 10022 qhdxliy#42.123.106.11
Debugging output:
OpenSSH_7.5p1, LibreSSL 2.5.4
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 52: Applying options for *
debug1: Connecting to 42.123.106.11 [42.123.106.11] port 10022.
debug1: Connection established.
debug1: identity file /Users/zhaokai/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/zhaokai/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/zhaokai/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/zhaokai/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/zhaokai/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/zhaokai/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/zhaokai/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/zhaokai/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.5
debug1: Remote protocol version 2.0, remote software version OpenSSH_100.0
debug1: match: OpenSSH_100.0 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 42.123.106.11:10022 as 'qhdxliy'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: diffie-hellman-group-exchange-sha256
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: umac-64#openssh.com compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: umac-64#openssh.com compression: none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<3072<8192) sent
debug1: got SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: got SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: ssh-rsa SHA256:iqMu6xmkaocbmHW4ejr0REqMGiIBVgaBz4CkocSwopI
debug1: Host '[42.123.106.11]:10022' is known and matches the RSA host key.
debug1: Found key in /Users/zhaokai/.ssh/known_hosts:7
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/zhaokai/.ssh/id_rsa
Authentication failed.
The password auth is tried after the public key. If you don't want your ssh client to try your public key first, use the PreferredAuthentications option, i.e.
ssh -o "PreferredAuthentications=password" [other options... ]
Source: the AUTHENTICATION section of ssh's manual page states:
The methods available for authentication are: GSSAPI-based authentication, host-based authentication, public key authentication, challenge-response authentication, and password authentication.
Authentication methods are tried in the order specified above, though PreferredAuthentications can be used to change the default order.
Related
Hy,
I need to put a file using scp from a ubuntu 18.04 server to a Raspberry, the file is created in the destination directory but it is at 0 bytes and scp freezes.
This is the scp command:
scp -v /home/solergy/MANGO/MA_HOME_TERLIZZI/STM32_BINARIES/S07E-MCU-3AX.bin solergy#172.16.9.14:/home/solergy/ARTESHELL_IP/bin/
and this is the log on Ubuntu server sending the file:
Executing: program /usr/bin/ssh host 172.16.9.14, user
solergy, command scp -v -t /home/solergy/ARTESHELL_IP/bin/
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 172.16.9.14 [172.16.9.14] port 22.
debug1: Connection established.
debug1: identity file /home/solergy/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /home/solergy/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/solergy/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/solergy/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/solergy/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/solergy/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/solergy/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/solergy/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4p1 Raspbian-10+deb9u6
debug1: match: OpenSSH_7.4p1 Raspbian-10+deb9u6 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 172.16.9.14:22 as 'solergy'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305#openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305#openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecds..........256 SHA256:GLpj.......................o1ng
debug1: Host '172.16.9.14' is known and matches the ECDSA host key.
debug1: Found key in /home/solergy/.ssh/known_hosts:14
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:N0Ci............ihb/zI1DB..........Pc /home/solergy/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/solergy/.ssh/id_dsa
debug1: Trying private key: /home/solergy/.ssh/id_ecdsa
debug1: Trying private key: /home/solergy/.ssh/id_ed25519
debug1: Next authentication method: password
debug1: Authentication succeeded (password).
Authenticated to 172.16.9.14 ([172.16.9.14]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions#openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00#openssh.com want_reply 0
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending command: scp -v -t /home/solergy/ARTESHELL_IP/bin/
Sending file modes: C0777 189264 S07E-MCU-3AX.bin
Sink: C0777 189264 S07E-MCU-3AX.bin
And this is the empty file created:
Any idea about where is the problem and how I can solve it.
Thanks,
Antonio
what is strange is that I've no problem using ssh to access the remote server, instead scp is not working.
I created public and private keys and updated the public keys in the authorised keys file on the server. But when I try to access the server from my Mac I am still getting the prompt to login. When I try to debug, I am getting the below log message.
Pradeep:~ pkumar$ ssh -v pradeep#10.21.21.46
OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 10.21.21.46 [10.21.21.46] port 22.
debug1: Connection established.
debug1: identity file /Users/pkumar/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/pkumar/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/pkumar/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/pkumar/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/pkumar/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/pkumar/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/pkumar/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/pkumar/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2
debug1: match: OpenSSH_7.2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 10.51.1.36:22 as 'pradeep'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256#libssh.org
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:MkMVA3YQfMFzUv3IxILEVdo0VBr1+aHuQP4YTCbZJg4
debug1: Host '10.21.21.46' is known and matches the RSA host key.
debug1: Found key in /Users/pkumar/.ssh/known_hosts:14
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: password
debug1: Next authentication method: password
pradeep#10.21.21.46's password:
Where am I going wrong.
debug1: Authentications that can continue: password
This says that either client or server does not support public key authentication. Client is probably ok, unless you modified your /etc/ssh/ssh_config.
If you have access to the server configuration, check the server /etc/ssh/sshd_config and make sure there is enabled PubkeyAuthentication yes.
I'm following below tutorial.
https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2
It's generated file on Windows 10 C:\Users\<user name>\.ssh
I'm using GIT to generate files.
~/Desktop
$ PermitRootLogin without-password
bash: PermitRootLogin: command not found
$ ssh a#b.com
a#b.com's password:
Permission denied, please try again.
I have generated .ppk file using puttygen.exe.
Still not able to connect to server.
By doing ssh -Tv a#b.com
It will give below response
OpenSSH_7.1p2, OpenSSL 1.0.2h 3 May 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to a#b.com [XXX.XXX.XXX.XX] port 22.
debug1: Connection established.
debug1: identity file /c/Users/XUser/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to a#b.com:22 as 'XUser'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client chacha20-poly1305#openssh.com <implicit> none
debug1: kex: client->server chacha20-poly1305#openssh.com <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:WrjAO7ldoJ3vjYENd6v7JvxXkbquvvom16RYGKeRO70
debug1: Host 'a#b.com' is known and matches the ECDSA host key.
debug1: Found key in /c/Users/XUser/.ssh/known_hosts:2
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /c/Users/XUser/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /c/Users/XUser/.ssh/id_dsa
debug1: Trying private key: /c/Users/XUser/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/XUser/.ssh/id_ed25519
debug1: Next authentication method: password
XUser#a#b.com's password:
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
XUser#a#b.com's password:
If you do have
your public key: C:\Users\<user name>\.ssh\id_rsa.pub
your private key: C:\Users\<user name>\.ssh\id_rsa
Do copy your public key (see "How To Use SSH Keys with DigitalOcean Droplets")
I am trying to set up a git server on my local mac machine.
I followed steps mentioned in the link.
But somehow even though I am able to ping the machine, when I try to connect to the machine using ssh git#ip_address.com, it gives error- "Permission denied (public key)"
Not able to find an answer for this error.
If someone faced the issue and has a solution, please let me know.
Thanks in advance.
My command line data:
Kaustubhs-Pro:~ kaustubh$ ssh git#192.168.43.115 -v
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to 192.168.43.115 [192.168.43.115] port 22.
debug1: Connection established.
debug1: identity file /Users/kaustubh/.ssh/id_rsa type 1
debug1: identity file /Users/kaustubh/.ssh/id_rsa-cert type -1
debug1: identity file /Users/kaustubh/.ssh/id_dsa type -1
debug1: identity file /Users/kaustubh/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.2
debug1: match: OpenSSH_6.2 pat OpenSSH*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm#openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm#openssh.com none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA
b2:59:8a:cc:f8:1a:76:8f:2a:6f:f5:a1:2b:f1:ff:10
debug1: Host '192.168.43.115' is known and matches the RSA host key.
debug1: Found key in /Users/kaustubh/.ssh/known_hosts:3
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/kaustubh/.ssh/my_git_key
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: /Users/kaustubh/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/kaustubh/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).
You have no valid key in your your actual user kaustubh that can be used for the SSH auth. So add your public key to the authorized_keys of your GIT user.
So you can use
ssh-copy-id git#192.168.43.115
To add your actual public key to the git authorized keys. You have to login with username and password for the first time.
Trying to deploy my first web app and am having difficulty SSH into AWS. When I enter:
ssh -v -i ec2-myportfolio.pem root#ec2-23-23-165-24.compute-1.amazonaws.com
I get Permission denied(public key). I looked at a couple of the other responses on stack over flow like
this and this, but neither resolved the issue. Below is the error I get. Thanks in advance for the help.
OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
Warning: Identity file ec2-myportfolio.pem not accessible: No such file or directory.
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug1: Connecting to ec2-23-23-165-24.compute-1.amazonaws.com [23.23.165.24] port 22.
debug1: Connection established.
debug1: identity file /Users/jonathanschen/.ssh/id_rsa type 1
debug1: identity file /Users/jonathanschen/.ssh/id_rsa-cert type -1
debug1: identity file /Users/jonathanschen/.ssh/id_dsa type -1
debug1: identity file /Users/jonathanschen/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'ec2-23-23-165-24.compute-1.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /Users/jonathanschen/.ssh/known_hosts:8
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/jonathanschen/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/jonathanschen/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).
Jonathans-MacBook-Air-2:downloads jonathanschen$
I think your problem is in this line:
Warning: Identity file ec2-myportfolio.pem not accessible: No such file or directory.
Are you using the proper path reference and file name in your ssh command?