I need to do something as the logged in user, rather than as the webserver user.

Specifically I need to perform some Rational ClearCase modifications as their unix user to maintain the audit trail.

I have tried using su -c in a two-way pipe, but it insists that stdin must be a tty. sudo is not really feasable because it would need to be rolled out to a large number of linux and solaris boxes (which don't currently have it).

Neither CPAN or PerlMonks appear to have any options for a "run as" type module or snippet.

PS: speaking of searchin PerlMonks, I have made a PerlMonks mozilla search plugin which should be available from the mozilla search plugin download page soon.

Update: I notice that the Expect modules uses IO::Tty which I guess I need to communicate with an interactive process like su. Of course I could use Expect.pm, but I want to steer away from this whole approach if I can and am looking for ideas, but in retrospect, somthing somewhere has to be a setuid binary, and it may as well be su...


In reply to Doing things as a different user by aufflick

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.