I can't configure ssh key on my Synology NAS.
File ~/.ssh/authorized_keys
is not created or not updated.
On remote machine (NAS):
$ cd
$ chmod 700 .
$ chmod 700 .ssh
$ touch .ssh/authorized_keys
$ chmod 600 .ssh/authorized_keys
I updated /etc/ssh/sshd_config
to uncomment lines:
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
I restarted sshd:
$ sudo synoservicectl --reload sshd
On local machine:
$ ssh-keygen -t ed25519 -C "myemail@domain.com"
# key generated in custom location 'id_synology'
$ ssh-copy-id -i id_synology -f -p 2222 user1@192.168.1.2
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "id_synology.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
/usr/bin/ssh-copy-id: line 251: warning: here-document at line 251 delimited by end-of-file (wanted `EOF')
/usr/bin/ssh-copy-id: line 250: warning: here-document at line 250 delimited by end-of-file (wanted `EOF')
/usr/bin/ssh-copy-id: line 260: EOF: command not found
user1@192.168.1.2's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh -p '2222' 'user1@192.168.1.2'"
and check to make sure that only the key(s) you wanted were added.
On remote machine authorized_keys
is not updated. I tried without authorized_keys
, but file is not created. I also tried with rsa algorithm, with or without passphrase, but I have same result.
Any ideas? Or any logs to check why key is not copied?