Re: sudo syntax

From: Bill Campbell (freebsd_at_celestial.com)
Date: 08/27/04

  • Next message: Kevin D. Kinsey, DaleCo, S.P.: "Re: Messed up port updating (Was Re: Updated to 4.10, now portupgrade?)"
    Date: Thu, 26 Aug 2004 16:07:33 -0700
    To: freebsd-questions@freebsd.org
    
    

    On Thu, Aug 26, 2004, David Bear wrote:
    >I want to run a command
    >
    >tar czf - / | ssh id@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@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@somehost dd of=tar.tgz )

    Bill

    --
    INTERNET:   bill@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
    _______________________________________________
    freebsd-questions@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-questions
    To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
    

  • Next message: Kevin D. Kinsey, DaleCo, S.P.: "Re: Messed up port updating (Was Re: Updated to 4.10, now portupgrade?)"