Problems with the rsync task and user's SSH public key

Status
Not open for further replies.

escalibur

Dabbler
Joined
Jan 3, 2015
Messages
49
Ok I got it working now. The problem wasn't my public keys or such but user's directory permission. I changed it to 700 and now it works in both ways without inputing a password. :)


However my biggest issue still remains can I make rsync task to work from FreeNAS -> Synology. I'm still getting this message:

ULQ3E.jpg


Could I somehow define to rsync that my user is not 'root' (if it still thinks I'm using 'root') and also that my public key can be found from other directory?


ps. Huge thanks to both of you guys for the help so far!
 

Roger Wilco

Explorer
Joined
Jul 17, 2014
Messages
65
Hi,

I don't know why your current configuration shouldn't be fine, but try to add the Synology public key to the user through the FreeNAS UI (through "View Users"->"Modify user"-button)...
 

escalibur

Dabbler
Joined
Jan 3, 2015
Messages
49
I already had same public key in the user's public key field and I'm still receiving the same warning message. I have a feeling that this might be a bug or something because message appears within a second after I press "OK" so FreeNAS is not even trying to connect or do anything before that.
 

Joerg G

Dabbler
Joined
Jan 7, 2015
Messages
16
Hi,

I just configured and tried Rsync with SSH from Freenas to another Server the other day.

Here is what I did:
  1. Create Key Pair for user root on Freenas (id_rsa and id_rsa.pub in /root/.ssh)
  2. Copy Public key to remote server ~/.ssh/authorized_keys of user you want to connect with
  3. Copy Public key of remote server to Freenas /root/.ssh/known_hosts
Feel free to change Freenas root to another user of your choice, but this user must have a home directory where you need to generate and place the private and public key. I did not enter anything into the ssh key field in Freenas user maintenance screen.

In Rsync task screen you need to provide the remote username in front of the server seperated with @ (e.g. username@synology-ip).

HTH

Joerg
 

escalibur

Dabbler
Joined
Jan 3, 2015
Messages
49
Hello,

First thanks for your effort Joerg!

However it still doesn't work.


Here is my example with the user: pop

I already have a working SSH connection (with the user 'pop') between FreeNAS and Synology without using a password (which means that .ssh-path is right and working).

Home directory is in this format '/mnt/storage/users/pop/.ssh/' and it looks right to me. The issue seems to be on FreeNAS' side because as soon as I click 'add task' I'm getting this red message. Just like it's not even trying to connect before ensuring that the user is having the public key (which in my case it definitely has, or am I missing something?).

9t7bq.jpg





I've created a bug ticked about this https://bugs.freenas.org/issues/7429 and it seems that this can really be a bug aswell. Let's see how will it develop from now..
 

Joerg G

Dabbler
Joined
Jan 7, 2015
Messages
16
Try checking the box "Rsync Create" which prevents checking if the remote directory exists.
This helped for me...

Let me know...
 

escalibur

Dabbler
Joined
Jan 3, 2015
Messages
49
Nah, same thing mate. I've tested it before and I think I've already tried every possible combination with this.

I've enabled 'real time' console and this is what I'm getting:


Jan 8 22:51:12 NAS smbd[89737]: STATUS=daemon 'smbd' finished starting up and ready to serve connectionsmatchname: host name/name mismatch: 10.2.2.3 != (NULL)
Jan 8 22:51:12 NAS smbd[89737]: [2015/01/08 22:51:12.179554, 0] ../source3/lib/util_sock.c:1199(get_remote_hostname)
Jan 8 22:51:12 NAS smbd[89737]: matchname failed on 10.2.2.3
Jan 8 22:52:12 NAS smbd[89784]: STATUS=daemon 'smbd' finished starting up and ready to serve connectionsmatchname: host name/name mismatch: 10.2.2.3 != (NULL)
Jan 8 22:52:12 NAS smbd[89784]: [2015/01/08 22:52:12.185775, 0] ../source3/lib/util_sock.c:1199(get_remote_hostname)
Jan 8 22:52:12 NAS smbd[89784]: matchname failed on 10.2.2.3
Jan 8 22:53:12 NAS smbd[89831]: STATUS=daemon 'smbd' finished starting up and ready to serve connectionsmatchname: host name/name mismatch: 10.2.2.3 != (NULL)
Jan 8 22:53:12 NAS smbd[89831]: [2015/01/08 22:53:12.224252, 0] ../source3/lib/util_sock.c:1199(get_remote_hostname)
Jan 8 22:53:12 NAS smbd[89831]: matchname failed on 10.2.2.3
Jan 8 22:54:12 NAS smbd[89879]: STATUS=daemon 'smbd' finished starting up and ready to serve connectionsmatchname: host name/name mismatch: 10.2.2.3 != (NULL)
Jan 8 22:54:12 NAS smbd[89879]: [2015/01/08 22:54:12.230275, 0] ../source3/lib/util_sock.c:1199(get_remote_hostname)
Jan 8 22:54:12 NAS smbd[89879]: matchname failed on 10.2.2.3
Jan 8 22:55:12 NAS smbd[89938]: STATUS=daemon 'smbd' finished starting up and ready to serve connectionsmatchname: host name/name mismatch: 10.2.2.3 != (NULL)
Jan 8 22:55:12 NAS smbd[89938]: [2015/01/08 22:55:12.269084, 0] ../source3/lib/util_sock.c:1199(get_remote_hostname)
Jan 8 22:55:12 NAS smbd[89938]: matchname failed on 10.2.2.3
Jan 8 22:56:12 NAS smbd[90990]: STATUS=daemon 'smbd' finished starting up and ready to serve connectionsmatchname: host name/name mismatch: 10.2.2.3 != (NULL)
Jan 8 22:56:12 NAS smbd[90990]: [2015/01/08 22:56:12.274646, 0] ../source3/lib/util_sock.c:1199(get_remote_hostname)
Jan 8 22:56:12 NAS smbd[90990]: matchname failed on 10.2.2.3
Jan 8 22:57:12 NAS smbd[92207]: STATUS=daemon 'smbd' finished starting up and ready to serve connectionsmatchname: host name/name mismatch: 10.2.2.3 != (NULL)
Jan 8 22:57:12 NAS smbd[92207]: [2015/01/08 22:57:12.313740, 0] ../source3/lib/util_sock.c:1199(get_remote_hostname)
Jan 8 22:57:12 NAS smbd[92207]: matchname failed on 10.2.2.3

If this is not a bug in util_sock.c then I really don't know.

Don't care about an IP address it's not the one I'm actually using with this. :)
 

Joerg G

Dabbler
Joined
Jan 7, 2015
Messages
16
But that looks like an samba issue to me and is not related to Rsync...

Wondering...
 

escalibur

Dabbler
Joined
Jan 3, 2015
Messages
49
I just can't understand what is causing this "mismatch" when I'm using an IP not hostname and the IP is definitely the one my Synology is using (yes it's powered on :)).
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Umm.. hostname mismatch means the IP doesn't resolve to the correct hostname (and vice versa). It's a security feature and almost certainly won't work since you aren't running a DNS server at home... are you? ;)
 

escalibur

Dabbler
Joined
Jan 3, 2015
Messages
49
My router works as a DNS server but anyway I've added this IP manually to the FreeNAS' host name data base. Now I'm not getting those mismatch errors. However this rsync task still doesn't work.
 

Joerg G

Dabbler
Joined
Jan 7, 2015
Messages
16
Are you using these two users pop and pop1 from your screenshot above?
Where pop is your freenas user and pop1 is the user from the remote machine?

User pop has an assigned home directory where both public and private ssh key can be found in .ssh directory?
And public key of user pop is copied to remote authorized_keys file of user pop1?

The above error message mentioning util_sock.c is clearly pointing to samba and not rsync issues.

And just to make sure again: a ping and also normal ssh to the remote machine is working now with user pop?

What about following rsync test?

Code:
rsync -av -e 'ssh -i /pop/.ssh/rsa_id' /mount/storage/data1 pop1@10.1.2.2:/volume1/demodisk/share
 

Joerg G

Dabbler
Joined
Jan 7, 2015
Messages
16
Another thing to check:

Is user pop1 allowed to access the target directory path???
 

escalibur

Dabbler
Joined
Jan 3, 2015
Messages
49
I'm not using 'pop' user at all. It was just an example. I have only one username which is created on both sides with the same username and same password.


Your test line works just fine with my right username(s), IP (of Synology) and all three directories.

<command>
sending incremental file list
<flow of the files>
 

Joerg G

Dabbler
Joined
Jan 7, 2015
Messages
16
Hm... Then I don't know...

Maybe it would be a workaround to create a crontab entry with that rsync command...
 

escalibur

Dabbler
Joined
Jan 3, 2015
Messages
49
Thanks for your effort Joerg G. Let's see how this develops as a reported bug.
 
Status
Not open for further replies.
Top