Re: Trying to elevate rsync privileges when connecting over ssh without using NOPASSWD in sudoers
"Dr. Mark Asbach via rsync" <[email protected]>
| Newsgroups | gmane.network.rsync.general |
|---|---|
| Message-ID | <[email protected]> |
Hi there, hi past me,
> My (non-working) attempt:
> […]
> So it seems the "-l" is dropped into the void letting ssh assume USER was the target host? I don’t actually get what I can do.
Turns out, I have to write down the description of my issue and then send the email before I magically understand the solution ;-)
Here’s a working example that does not need a wrapper script:
PASSWORD=<SUDOPASS> rsync -vv --delete-after --delay-updates '/bin/sh -c "{ echo $PASSWORD; cat - ; } | ssh -i ~/.ssh/id.key $0 $* &"' --rsync-path='sudo -S rsync‘ ./SRCDIR USER@HOST:DSTDIR
The trick was actually to add "$0" because $* will drop the first argument from the list as this typically is the name of the script itself (duh!).
Hope this is of help to anyone,
Mark
--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
smime.p7s
(application/pkcs7-signature, 4.5 KB) - not displayed