What does a FreeNAS public key look like?

Status
Not open for further replies.

mvcad

Contributor
Joined
Feb 25, 2018
Messages
116
Hi All,
We bought a Freenas mini-xl to upgrade our current synology box so I am trying to set up an rsync task to migrate all data over the weekend. I've been trying to use this guide : https://www.mattwall.co.uk/2016/04/03/rsync-to-synology-from-freenas.html but I got stuck in the part when I have to paste the public key into a field in Freenas GUI and also paste it into the authorized_keys file on our synology. when printing the Freenas public ID it looks like this: ssh-rsa + {SPACE} + averylongchainofcharacters + {SPACE} + user1@freenas.local.

so my question is: should I include the strings "ssh-rsa" and "user1@freenas.local" as part of the key when pasting it to the public key field? and also when pasting it into the authorized_keys file?

As you can imagine I cannot ssh to my synology without typing a password, which is ultimately what I want to do.
system : Freenas mini XL running Freenas 11.1 U5, 4 X 4TB WD reds in RAIDZ2 with mirrored samsung EVO SSD for ZIL (SLOG)

TIA.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
@m0nkey_ is basically correct. The authorized_keys file lists authorized keys, one per line. You have to make sure that the id_rsa.pub from the source system gets entered as a single line. In some cases, you may need to prepend additional arguments such as

from="1.2.3.4",command="/foo/bar" ssh-rsa <big ssh key> <user@host>

which would only allow the key to be used from the IP 1.2.3.4 and would only allow /foo/bar to be executed. This isn't generally required. However, I explain it so that you can understand the importance of having this as a single line, as you could list dozens or hundreds of authorized keys in this file, so you do actually need to make sure the key is entered cleanly on a single line.
 

mvcad

Contributor
Joined
Feb 25, 2018
Messages
116
Thank you all, I managed to copy my public id using ssh-copy-id command. However I am using a windows 10 machine with putty so when copying the key from putty into Freenas GUI I am not sure if I am doing it correctly. Can I simply copy and paste from putty to FN GUI opened In firefox? Is there any better method?
 

HoneyBadger

actually does care
Administrator
Moderator
iXsystems
Joined
Feb 6, 2014
Messages
5,112
Thank you all, I managed to copy my public id using ssh-copy-id command. However I am using a windows 10 machine with putty so when copying the key from putty into Freenas GUI I am not sure if I am doing it correctly. Can I simply copy and paste from putty to FN GUI opened In firefox? Is there any better method?

When I copied an id_rsa.pub from PuTTY on a Windows machine, it showed up in the paste buffer as a single line:
Code:
ssh-rsa AAAAAreallylonglineofgibberishhere username@hostname.domain

Pasting directly into the Firefox window should work. Failing that you could use WinSCP to copy the actual id_rsa.pub file to your local machine, open it with Notepad, and then make sure it's not trying to word-wrap it for some reason?
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Depending on the terminal emulation and settings being used, PuTTY may or may not break at the right hand edge when pasting.

If you know how to use "vi", you can use "$" to go to the end of the line, and if it isn't actually correct, you can "J" to join the following line, and then "x" to get rid of the whitespace that it replaces the end-of-line character with. Given the length of an SSH key, you might need to do that more than once.

Or you can open a reeeeeallllly wiiiiiiiiiiiide putty.
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
If you're going to lure new users to vi, at least give them a link on how to exit vi!
https://stackoverflow.com/questions/11828270/how-to-exit-the-vim-editor
But there is nothing more satisfying than seeing a new vi user do this:
^c^c^c^c^cquitexit^x^xN*(&$C#p98uco[cifdjs;fodwtfbbq! *hits reset switch*
Protip: To exit vi, press escape to go into normal mode, then type :q to quit. If you want to save changes and quit type :wq or exit without saving changes type :q!.
 

wblock

Documentation Engineer
Joined
Nov 14, 2014
Messages
1,506
User-friendly tip: ee is present on FreeNAS. It's a normal, non-modal screen editor with an onscreen menu showing key commands. Home and End keys should work, too.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
User-friendly tip: ee is present on FreeNAS.
That one seems to fly under the radar a lot. nano is installed too, so you shouldn't ever have to deal with vi.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
That one seems to fly under the radar a lot. nano is installed too, so you shouldn't ever have to deal with vi.

Yeah, but both ee and nano are crap at this sort of thing.

If you're going to lure new users to vi, at least give them a link on how to exit vi!
https://stackoverflow.com/questions/11828270/how-to-exit-the-vim-editor

If I was going to lure new users to vi, I wouldn't have used the words "If you know how to use vi."

christensen-candy-van.jpg
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
How so? OK, use nano -w then--it disables word wrap. It's simple, it works well. Or you can use an ancient torture device which can be beaten into submission and used to edit text.
 
Joined
Dec 29, 2014
Messages
1,135
For some of us grumpy old Unix farts, vi is the editor of choice. That's the way it was, and we liked it! :)
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
How so? OK, use nano -w then--it disables word wrap. It's simple, it works well. Or you can use an ancient torture device which can be beaten into submission and used to edit text.

Now you have to use the right command line flags? "Geez."

At this point it is probably better to note that you can do "cat >> ~/.ssh/authorized_keys" at the command line, paste in the text, hit carriage return, then control-D.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Well, sure, if you recite the proper incantations in the dead of night, hold your tongue at the right angle, and wave a dead chicken, I'm sure you can make it do what you need...
 
Joined
Dec 29, 2014
Messages
1,135
Past tense?

It was a Dana Carvey Saturday Night Live! reference. I still like it. As I said, it is still my editor of choice. Then again, the first Unix I used was Xenix (Licensed port by Microsoft) System III on an Altos system powered by an 80186. Yes, I know that makes me old...
 
Status
Not open for further replies.
Top