I want the rsync user on my Synology box (called synology) to use ssh with no password.
First I create the ssh key
1
|
|
When asked for the password for the key simply hit enter
key, and again.
This will create a private key and public key in
1 2 |
|
Over on the Synology box (I assume you have ssh’d there as root)
1
|
|
Some hoops need to be jumped.
By default you can’t get to the home directory of a user, it is mapped to a fake place Get around that by:-
- go to Users admin page
- click advanced
- turn on “home services”
Now you need to modify the home dir permissions
1 2 3 |
|
Now you need to actually give your user a shell.
as root edit /etc/passwd
You need an entry like
1
|
|
Notice that the last section is a real shell /bin/ash if it is not a shell you can’t log in.
Now you need to modify /etc/ssh/sshd_config
make sure it has the following lines:-
1 2 3 |
|
Finally you need to create the authorized_keys file in the users account an add a public key to it. Beware that file permissions are crucial here or ssh will refuse you.
1 2 3 4 5 6 7 8 |
|
Then add a public key corresponding to a private key that you own on one line in the file either use vi an paste it in or from another PC you can use ssh and cat (you’ll need to use password for the user until you are done)
Assume my pub key is at ~/.ssh/id_rsa.pub and I want the rsync users authorized_keys file to hold contain that key..
1
|
|
After being prompted for the password the key will be in place.. now restart synology or quicker just get the ssh daemon to re-read its config
1 2 3 4 |
|
You should now be able to ssh to synology as rsync with no password
1
|
|