How To Give SSH Options To Rdist

Home » CentOS » How To Give SSH Options To Rdist
CentOS No Comments

Hello, I’m trying to configure rdist over SSH so that it connects at target side as a particular user.

I’m using CentOS 7.3 on both ends (I also tested with Fedora 25 with the same behavor)

So I create at source side the file ~/.ssh/config under mysourceuser home

Host targetsrv.localdomain.local
HostName targetsrv.localdomain.local
User mytargetuser

Then, connected as mysourceuser user on local server

$ SSH targetsrv.localdomain.local mytargetuser@targetsrv.localdomain.local’s password:

So far so good as expected.

But if I create a small distfile to distribute a file on targetsrv.localdomain.local and execute rdist on it, I receive the prompt of mysourceuser password, not mytargetuser one….

$ rdist -P /usr/bin/ssh -f ./distfile distrotest mysourceuser@targetsrv.localdomain.local’s password:

It seems the config file is not honored. I tried different combinations but none worked eg creating a wrapper script that runs SSH -F config_file “$@”

I can workaround the problem using inside the distfile
“mytargetuser@targetsrv.localdomain.local” instead of
“targetsrv.localdomain.local” , this way it works. But I would like to avoid it if possible as I have a distfile with many entries and variables as destination hosts target.

Any help appreciated

Thanks, Gianluca

LEAVE A COMMENT