I cannot access freenas using SSH private keys.

Status
Not open for further replies.

Estropelic

Contributor
Joined
Feb 8, 2016
Messages
107
OpenSSH_6.9p1 Ubuntu-2ubuntu0.1, OpenSSL 1.0.2d 9 Jul 2015
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to freenas [192.168.1.102] port 22.
debug1: Connection established.
debug1: identity file /home/daniel/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/daniel/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/daniel/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/daniel/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/daniel/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/daniel/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/daniel/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/daniel/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9p1 Ubuntu-2ubuntu0.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1_hpn13v11 FreeBSD-20140420
debug1: match: OpenSSH_6.6.1_hpn13v11 FreeBSD-20140420 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to freenas:22 as 'estropelic'
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:JYs42z9p90xKeXmf5LmtZ7pC8vUoHLn8w0KiVLfVH5c
debug1: Host 'freenas' is known and matches the ECDSA host key.
debug1: Found key in /home/daniel/.ssh/known_hosts:3
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
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/daniel/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Offering DSA public key: daniel@daniel-HP-t620-PLUS-Quad-Core-TC
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/daniel/.ssh/id_dsa
debug1: Trying private key: /home/daniel/.ssh/id_ecdsa
debug1: Trying private key: /home/daniel/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

What am I doing wrong? Permissions on volume are set to unix perms.
 

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
debug1: Offering RSA public key: /home/daniel/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Offering DSA public key: daniel@daniel-HP-t620-PLUS-Quad-Core-TC
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/daniel/.ssh/id_dsa
debug1: Trying private key: /home/daniel/.ssh/id_ecdsa
debug1: Trying private key: /home/daniel/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).
Seems that you don't have the correct private key in order to connect.
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
What did you do to set this up? You don't have a key that can be used to it could be that the key isn't available, permissions are wrong or something else.
 
D

dlavigne

Guest
That article is 6 years old. How to create the keys is correct but how to store them in FreeNAS (and its config database) is not. You need to paste the public key into the user's account using Account -> Users -> username -> SSH Public Key.
 

Estropelic

Contributor
Joined
Feb 8, 2016
Messages
107

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
What are the permissions on ~/.ssh? What about on the authorized_keys file? Improper permissions (likely if the user's home directory is in a Windows dataset) will cause ssh to refuse to accept the key.
 

Estropelic

Contributor
Joined
Feb 8, 2016
Messages
107
daniel@daniel-HP-t620-PLUS-Quad-Core-TC:~/.ssh$ ssh -v estropelic@freenas
OpenSSH_6.9p1 Ubuntu-2ubuntu0.1, OpenSSL 1.0.2d 9 Jul 2015
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to freenas [192.168.1.102] port 22.
debug1: Connection established.
debug1: identity file /home/daniel/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/daniel/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/daniel/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/daniel/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/daniel/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/daniel/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/daniel/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/daniel/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9p1 Ubuntu-2ubuntu0.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1_hpn13v11 FreeBSD-20140420
debug1: match: OpenSSH_6.6.1_hpn13v11 FreeBSD-20140420 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to freenas:22 as 'estropelic'
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:a2T3Y9th/wfNNsDSWVeHLlULnepThEc3ubANuMT2vaU
debug1: Host 'freenas' is known and matches the ECDSA host key.
debug1: Found key in /home/daniel/.ssh/known_hosts:1
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
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/daniel/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/daniel/.ssh/id_dsa
debug1: Trying private key: /home/daniel/.ssh/id_ecdsa
debug1: Trying private key: /home/daniel/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

Settings on User Home/.ssh:
drwx------ 2 estropelic freenas 3 Mar 19 15:31 ./
drwxr-xr-x 3 estropelic freenas 12 Mar 19 15:34 ../
-rw------- 1 estropelic freenas 373 Mar 19 16:14 authorized_keys
estropelic@freenas:~/.ssh %

Settings on User Home:
estropelic@freenas:~/.ssh % ls -l
total 26
drwx------ 2 estropelic freenas 3 Mar 19 15:31 ./
drwxr-xr-x 3 estropelic freenas 12 Mar 19 15:34 ../
-rw------- 1 estropelic freenas 373 Mar 19 16:14 authorized_keys
estropelic@freenas:~/.ssh % cd
estropelic@freenas:~ % ls -l
total 134
drwxr-xr-x 3 estropelic freenas 12 Mar 19 15:34 ./
drwxrwxrwx 19 nobody nobody 20 Mar 19 15:31 ../
-rw-r--r-- 1 estropelic freenas 898 Mar 19 15:31 .cshrc
-rw------- 1 estropelic freenas 511 Mar 19 16:11 .history
-rw-r--r-- 1 estropelic freenas 186 Mar 19 15:31 .login
-rw-r--r-- 1 estropelic freenas 91 Mar 19 15:31 .login_conf
-rw------- 1 estropelic freenas 301 Mar 19 15:31 .mail_aliases
-rw-r--r-- 1 estropelic freenas 267 Mar 19 15:31 .mailrc
-rw-r--r-- 1 estropelic freenas 680 Mar 19 15:31 .profile
-rw------- 1 estropelic freenas 212 Mar 19 15:31 .rhosts
-rw-r--r-- 1 estropelic freenas 909 Mar 19 15:31 .shrc
drwx------ 2 estropelic freenas 3 Mar 19 15:31 .ssh/
estropelic@freenas:~ %
 

Estropelic

Contributor
Joined
Feb 8, 2016
Messages
107
Status
Not open for further replies.
Top