sudo syntax
Bill Campbell
freebsd at celestial.com
Thu Aug 26 16:07:35 PDT 2004
On Thu, Aug 26, 2004, David Bear wrote:
>I want to run a command
>
>tar czf - / | ssh id at somehost dd of=tarball.tgz
>
>I need to run tar as root. However, I need to run ssh as user 'id'.
>
>I tried
>
>sudo tar czf - / | ssh id at somehost dd of=tar.tgz
>
>but am unsure if ssh was launched as 'id' or as root.
Everthing to the left of the pipe symbol is one process (e.g. sudo), the
process to the right is independent of that, and will run as the normal
user.
>Any way to be certain that sudo is doing what I want?
You could do something like this if you want to see it which would display
the output of id before starting the right side ssh command.
sudo tar czf - / | ( id ; ssh id at somehost dd of=tar.tgz )
Bill
--
INTERNET: bill at Celestial.COM Bill Campbell; Celestial Systems, Inc.
UUCP: camco!bill PO Box 820; 6641 E. Mercer Way
FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/
``It is surprising how much new stuff users find that developers never do.
You put a copy in front of a normal user and they find all these bugs that
you would think developers would find. The real users and developers are
completely different species as far as I am concerned.''
--Linux creator Linus Torvalds
More information about the freebsd-questions
mailing list