# rsync -> avoiding the password prompt for SSH



## ccc (Dec 28, 2009)

hi

I'd like to synchronize 2 freeBSD machines using rsync.
One machine is a server with rsync daemon and the second one is the client.
On the server I've created /etc/rsyncd.conf and rsyncd.secrets. 
Howto use rsync with --password-file option at SSH command prompt on the client to avoid password question?

BTW *Is it possible to do that without SSH public/private key exchange?*

If I try from the clinet:
	
	



```
# rsync --password-file=/usr/local/etc/rsyncd.secrets /var/new/ root@192.168.1.10:/var/backup
The --password-file option may only be used when accessing an rsync daemon.
rsync error: syntax or usage error (code 1) at main.c(1239) [sender=3.0.4]
```


----------



## SirDice (Dec 28, 2009)

Just set up a public/private key without a password. Use that to authenticate.


----------



## ccc (Dec 28, 2009)

SirDice said:
			
		

> Just set up a public/private key without a password. Use that to authenticate.



I'd like to do that, if possible, without public/private key exchange.


----------



## dennylin93 (Dec 28, 2009)

ccc said:
			
		

> I'd like to do that, if possible, without public/private key exchange.



Why do you want to do it without keys?


----------



## ccc (Dec 28, 2009)

just wondering, if it works and ssh configuration stay untouched.


----------



## SirDice (Dec 28, 2009)

ccc said:
			
		

> just wondering, if it works and ssh configuration stay untouched.



You don't need to change the ssh configuration to make keys work.


----------



## vivek (Dec 28, 2009)

ccc said:
			
		

> I'd like to do that, if possible, without public/private key exchange.



It is possible, but it is unsecure as your password is exposed in a clear text format in shell or expect script itself. Google for sshpass utility. It does the same thing.

```
sshpass -p 'PassWord' ssh -o StrictHostKeyChecking=no username@server.example.com
```
OR

```
sshpass -p 'PassWord' rsync command
```


----------

