You have two messages there.
The first is telling you that you don't yet know the fingerprint of the public key of the machine that you are connecting to. Before accepting it, check that the fingerprint is correct, by transiting via a separate secure channel (it is ok if someone else sees it, but they must not be able to replace it with their own).
The second part root@<host>: Permission denied (publickey).
is a little ambiguous. But here are some things to check:
sshd
(the server), is usually configured to block root login. You need to add a new user, with sudo
permissions. Or a less good solution is to change the configuration of ssh
, to allow root login.
Then check, that you:
- Put your public key into
~root/.ssh/authorized_keys
?
- Set the permission so that no other groups or other can read or write to
~root/.ssh
, or the files in it, but root can at least read.
- Add your key to your agent (
ssh-add
).
If that does not work, then turn on verbose mode -v
or -vv
or -vvv
, start with one, and increase as needed.
If that does not work, then look at the logs at the remote end.
.ssh
directory? And also what is the permission of.ssh
directory itselfroot
to login can pose a security risk.ls -ld ~/.ssh
andls -l ~/.ssh