On Fri, Mar 16, 2007 at 05:03:01PM +0530, mohd tariq raza khan
wrote:> i have to first ssh as user with port 65300 and have to su - than
> only get root prompt of serverB.
This is a little easier if sudo also works, due to the way that su
demands that the whole command be quoted. So, the sudo way:
rsync -ave 'ssh -p 65300' --rsync-path='sudo rsync'
user@serverB:/src/ /dest/
For the su way to work, you need a shell script named "su-rsync":
#!/bin/sh
su - -c "rsync $*"
Put that on the path somewhere on serverB and run it like this:
rsync -ave 'ssh -p 65300' --rsync-path=su-rsync user@serverB:/src/
/dest/
Note that you can simplify some of those options by putting the port and
user details into your ~/.ssh/config file:
Host serverB
User user
Port 65300
Protocol 2
Then the rsync command gets even easier:
rsync -av --rsync-path=su-rsync serverB:/src/ /dest/
..wayne..