Unix::SavedIDs

If you're on a unix of some type, chances are you have saved ids. If this is new to you, as it was to me a week ago, here's what saved ids are. You have your real uid ($<) and your effective uid ($>) and you also have this thing called your saved user id. (You also have a saved gid.) You may notice that there is no nifty perl var for your saved uid or gid. The intention of saved ids is to allow a privileged process to drop root privileges from both the real and effective ids and then be able to switch back again later.

Because there was no existing maintained perl interface to the appropriate functions, I wrote Unix::SavedIDs.

The primary application that I foresee for Unix::SavedIDs is privileged processes that want to really become unprivileged and stay that way. Said another way, if you thought you dropped root and you didn't set your saved uid and saved gid, think again.

Unix::SavedIDs is just a direct map from the c functions to perl. The interface is sparse. I'm working on Proc::SetUser (though I may rename it to Unix::SetUser) which will give a much more friendly interface.

I must acknowledge Paul Fenwick and his Proc::UID, which basically did everything in Unix::SavedIDs and Proc::SetUser and he did it in 2004. Unfortunately, it hasn't been updated since 2004 and he expressly states that it shouldn't be used in production code.

Unix::SavedIDs is currently alpha code, but I'll be using it in production a lot, so expect it to be out of alpha pretty quickly. I'll be using it on Linux and OpenBSD , primarily in perl 5.8.x.

Send email to dmartin@cpan.org, or just msg me or comment on this node.

Thank you PerlMonks!

--Pileofrogs


In reply to Announcing Unix::SavedIDs by pileofrogs

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.