SSH Server with private key on mac

Hass.io installed on pi3
Just added the ssh server add-on
Used terminal to generate a public and private key
Added the public key to the text box and its all accepted.

Go back to terminal, new remote connection
user: root
press connect

It asks for password?

How do I actually set terminal up to know where the private key is? I haven’t moved it from the ssh folder?
The instructions for windows use putty but surely I can do this from terminal somehow?

Thanks

You can.

Ssh -i hass_ket.txt -p 22 [email protected]

Sorry still quite new to all this.

Not sure what the above means

hass_key.txt can be the name of my private key? but it says file not found. Should the X’s be the IP of the pi?

Sorry. I am enjoying playing with hassio but never realised it was so user-unfriendly towards new starters. Nothing is as simple as is made out I am finding

yes hass_ket.txt is the file that has my private key. x.x.x.x is the ip address…

what do you type in to connect via ssh? Whichever folder you run the ssh command from needs to have the key in it. (ls is the command to check).

This is all pretty basic fundamental linux stuff really… it is WAY more friendly than diving into hassbian or docker… you are shielded from 99% of anything advanced…

I guess its more my expectations than the actual complexity. With the nice looking interface etc I sort of assumed I could get involved and pick it up quite quickly. Granted I do not need the SSH part yet but just wanted to get as much working as possible.

I connect to the pi over terminal by going to New secure connection. the window looks like this almost (old picture off the internet) so the command is not being run from a folder as such it opens a new window connected to the hassio pi and asks for password.

image

Never seen anything like that on my Mac. My terminal is a command line just like I was using command prompt in Windows. Does that client even support keys?

In that box dropdown (ssh) for the connection, what are your options? I use iTerm2 which is command line albeit with a GUI to set it up.

Perhaps if you enter in the command line I gave you in my first reply as the server it might work. Either that or look in the help for that client.

My terminal is a command line too but the guide for connecting to the hassio install I found said to do the above.

It worked for when the SSH agent was set to use a password so I can always fall back to that. A normal terminal window starts with my “mattbarnes” folder which is mac -> users -> mattbarnes so I could put the key in there not an SSH folder within mattbarnes and give that a go when I get home.

Its not a big deal but you know when you find something you cannot do, all you want to do is resolve it!

All the guides for SSH to hassio with a private key use Putty and with Putty you have an interface to use to browse to your private key etc.

Can’t you just open Terminal, and type ssh root@ipaddress? I don’t know what application you are using there.

I am running terminal and the SSH add-on for hassio.

typing ssh [email protected] gives:

Warning: Permanently added ‘192.168.1.117’ (ECDSA) to the list of known hosts.
[email protected]’s password:

And I have not set a password because within the add-on for SSH in hassio I have added an rsa key instead of password

this gives the below error message then lets me into the Hassio SSH anyway…

Mattb:~ mattbarnes$ Ssh -i .ssh/hass_ket.txt -p 22 [email protected]

Warning: Identity file .ssh/hass_ket.txt not accessible: No such file or directory.

I added the ssh/ as that’s the directory with the private key in

who knows!

So you copied your key into a file called hass_ket.txt?? (That was my example name - your name could be different) Seems you have the command line right but you need to find the real folder where that key is AND the file name…

I amended the file to be called that but yes that did mean adding a file ext .txt to the file so maybe i should have just left it as is and changed the code. Will start again I think, new keygen and go from the beginning.

Sorry for what are probably really simple things but this is all new to me. Just tried adding the date_time sensor and formatting that and that’s not going smoothly either. Starting to see why people buy expensive software that’s easy to use for a layman, but will persevere!

Matt - you just need to be sure the path is right… that is probably the issue. It might be /users/.ssh/filename… you need to get the right path and filename… It’s EASY to get wrong.

If possible do a ls from the command prompt when you are not logged into hassio and with finder in another window it’s pretty easy to work out what the full paths is that you need to use… This is just basic file stuff - not rocket science.

My guess for the path on a Mac would be

/Users/your-username/.ssh/

1 Like