Need help with passwordless ssh key log in

Status
Not open for further replies.

elcoyote189

Cadet
Joined
Dec 4, 2015
Messages
7
I am trying to setup ssh with private and public keys on my freenas 9.10 problem is nothing I do works.
I have tried to add public keys via web gui
I have added the thru ftp directly to .ssh and renamed it authorized_keys
I have change the permissions to the following .ssh/ 700 and authorized_keys to 600
I have changed group permission to myself:myself ( I am the admin user)
I have used different text editors to paste the key via gui just in case
I changed puttygen from 2048 to 1024 just in case.

Please help really need this for work logs says. Authentication refused: bad ownership or modes for directory /***/***/HOME/.ssh
 

Vito Reiter

Wise in the Ways of Science
Joined
Jan 18, 2017
Messages
232
Turn on the SSH service, allow root login if you need it (Think that's bad practice). If non-root user, go edit the settings for said user in order with your specifications. Then on a client machine just connect via SSH, I use putty, once you log in it will ask if you want to exchange keys and just types 'yes' or 'y' whatever it says. I never had to import keys and such for a standard SSH connection.

Edit: Somehow after looking for a minute for the error you were getting I didn't see it until after this post. I must be blind :)
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Then on a client machine just connect via SSH, I use putty, once you log in it will ask if you want to exchange keys and just types 'yes' or 'y' whatever it says.
That must be something unique to PuTTY--never seen that behavior with Linux, FreeBSD, or Mac command-line SSH clients. Sounds handy, though.
 

Vito Reiter

Wise in the Ways of Science
Joined
Jan 18, 2017
Messages
232
Windows permissions on the dataset containing the HOME directory?

Definitely check these setting though, mine are set up as User: root Group: wheel. I don't have set permissions recursively on, but I never needed it to be.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
When you create a pool or a dataset, you're asked to specify the permissions type--Unix, Mac, or Windows. If you've chosen Windows, that's likely your problem.
 

Vito Reiter

Wise in the Ways of Science
Joined
Jan 18, 2017
Messages
232
Let's back up here for a second. What OS is the client machine running? I don't think you even mentioned Windows. Also, what are you using to connect with SSH?

Edit: Found this fix for Ubuntu/Linux here on the forums, not sure if this will help though
These steps will give you a clean slate for password-less ssh and should not be used if you have ssh keys setup that you don't want to lost.
1. Clean client's .ssh folder (on ubuntu)
$rm ~/.ssh/*

2. Clean FreeNAS user's .ssh folder (on FreeNAS)
$rm -r ~/.ssh

3. Creat new Private/Public Keys (on ubuntu)
$ssh-keygen -t rsa

4. Send FreeNAS Public Key (on ubuntu)
$ssh-copy-id user@freenas

4. Now test with ssh (on ubuntu)
$ssh 'user@freenas'
 

Vito Reiter

Wise in the Ways of Science
Joined
Jan 18, 2017
Messages
232
Went on an unknown machine and connected w/ putty here is a screenshot of what it does.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Went on an unknown machine and connected w/ putty here is a screenshot of what it does.
Yep, that's perfectly normal for ssh clients. But it doesn't add the client's key to the server's authorized_keys file to allow that client to log in without a password in the future, which is what we're talking about here.
 

Vito Reiter

Wise in the Ways of Science
Joined
Jan 18, 2017
Messages
232
Alright, did some extensive research. Looks like this issue is mainly caused by the user being used to log on not owning the actual directory. In the permissions, I would check 'Apply Owner (user)' and set the user to the one being utilized to log in. If root needs to own the mount point, then create a directory underneath it owned by the user you need to use. After all that, use puttygen create a public key and add it to the user under the 'Users' section of FreeNAS there will be a big 'Public Key' box in the settings for the user. After that try to SSH in with the client machine. You've probably done most of that but I think the main issue is the actual set owner of the directory you're trying to access.

My version is more of a TL;DR, I found this info HERE however, that page is using a MacOS X machine so I revamped the description a little to fit your situation as you don't have a Mac terminal, but the link is there for reference and my 8th grade English teacher would be upset if she knew I didn't cite my sources.
 
Status
Not open for further replies.
Top