I've been struggling for days with this now and can't find what I'm doing wrong.I've got a website on a VPS server. Every night I make a backup of the database. It gets stored on my VPS server. I also want to send a copy to my NAS (Synology DS214play) at home. Both servers operate on Linux.So I've logged into my VPS server (as root) and generated a ssh-keygen.On my VPS it looks like this:[root@vps /]# cd ~[root@vps ~]# ls -alhdr-xr-x---.  7 root root 4.0K Jun 25 18:58 .dr-xr-xr-x. 24 root root 4.0K Jun 25 19:33 ..drwx------   3 root root 4.0K Jun 25 20:29 .ssh[root@vps ~]# cd .ssh[root@vps .ssh]# ls -alhdrwx------  3 root root 4.0K Jun 25 20:29 .dr-xr-x---. 7 root root 4.0K Jun 25 18:58 ..-rw-------  1 root root 1.7K Jun 26 07:27 id_rsa-rw-r--r--  1 root root  403 Jun 26 07:27 id_rsa.pub-rw-------  1 root root  394 Jun 25 20:29 known_hostsThen I copied the file to the NAS by using ssh-copy-idadmin@NAS:/$ cd ~admin@NAS:~$ ls -alhdrwxrwxrwx  6 admin users 4.0K Jun 26 07:28 .drwxrwxrwx 13 root  root  4.0K Jun 21 20:57 ..drwx------  2 admin users 4.0K Jun 26 07:28 .sshadmin@NAS:~$ cd .sshadmin@NAS:~/.ssh$ ls -alhdrwx------ 2 admin users 4.0K Jun 26 07:28 .drwxrwxrwx 6 admin users 4.0K Jun 26 07:28 ..-rw------- 1 admin users  403 Jun 26 07:27 authorized_keysWhen looking into VPS/id_rsa.pub and NAS/authorized_keys I see that both keys are identical. Now I'm trying to copy a test file from the VPS to the NAS by using:[root@vps /]# scp -i ~/.ssh/id_rsa /test.txt admin@___.___.___.___:/volume1/SQL_backupThat however results in shell asking me for the password (every time).How come that I have to keep giving my pass?
SCP command keeps asking password
linux;ssh;scp;authorization
When troubleshooting problems with daemons, you should always check the system logs.In this particular case, if you check your system logs on the NAS host, you'll see something similar to:Authentication refused: bad ownership or modes for directory /home/adminThe problem is shown in this output:admin@NAS:~$ ls -alhdrwxrwxrwx  6 admin users 4.0K Jun 26 07:28 .For security, SSH will refuse to use the authorized_keys file if any ancestor of the ~/.ssh directory is writable by someone other than the user or root (ancestor meaning /home/user/.ssh, /home/user, /home, /). This is because another user could replace the ~/.ssh directory (or ~/.ssh/authorized_keys file) with their own, and then ssh into your user.To fix, change the permissions on the directory with something like:chmod 755 ~