Trying to use rsync to update a local copy of a website from the one sitting on
Normally I can use
rsync -vare ssh user at host:src_dir/* local_dir/ --exclude-from=local_dir/EXCL
But in this case I need to be able to switch user after login in order to
retreive the files fully due to permissions, before any one askes its not root,
but a common website editing account shared between a few members. Additionally
loging in remotely as the shared user will not work either.
I was looking at
rsync -var --rsh="ssh -l user host su - new_user" :src_dir/* local_dir/
But rsync terminates the connection. Is it possible to do it this way, in which
case could someone point out what I'm missing or do I have to resort to a script
in order to be able to perform this?
output from rsync is
bash: su - new_user: command not found
rsync: connection unexpectedly closed (0 bytes read so far)
rsync error: error in rsync protocol data stream (code 12) at io.c(342)
experimenting from the command line with just ssh gets the message
su: must be run from a terminal
So that suggests what the problem rsync is having but isn't any assistance in
building a new command line that would work.
Setting up a script on the far side to run when I login is no good since I
sometimes need to be able to ssh in without becoming a different user
Additionally taring and bziping the website up and downloading it is not really
an option. Once in a while that can be done, the rest of the time I need to be
able to use either rsync over ssh or some other system than only retreives
modified files over ssh.
"Nothing's foolproof to a sufficently talented fool"
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!