The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Valor, meet Discretion

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Daniel Berger

Posts: 1383
Nickname: djberg96
Registered: Sep, 2004

Daniel Berger is a Ruby Programmer who also dabbles in C and Perl
Valor, meet Discretion Posted: Mar 29, 2005 9:42 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Daniel Berger.
Original Post: Valor, meet Discretion
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Daniel Berger
Latest Posts From Testing 1,2,3...

Advertisement
I've been working on methods for adding, configuring, and deleting users and groups as part of the Admin package. This is fairly trivial on the Win32 platform, where the Win32 API is kind enough to provide me with some handy methods for performing such operations.

Unix, on the other hand, is very unfriendly in this regard. The only functions I could find to help me were putpwent() and putspent(), and these are "discouraged" because it's a multi-step process to add a passwd entry, and it only works for local entries (i.e. no NIS). You have to open the file, lock the, write the entry to the passwd file, write the entry to the shadow file, unlock the passwd file, and then close the file. This is to say nothing of handling password encryption, or figuring out if and where shadow password files exist on other platforms. Oh, and there are no methods for configuring or deleting users or groups.

So, I have two choices. The first is to write my own functions for adding, deleting and configuring users. Ick. That could take a while, and would require lots of thorough testing. I don't want to mess up someone's passwd file, you know. The second choice, and the one I'm heavily leaning towards now, is to simply use a system call, e.g. system("useradd -blah blah").

I'll have to see just how "standard" the options to useradd, etc, are across different flavors of Unix, though.

Read: Valor, meet Discretion

Topic: Method Check: Date#succ Previous Topic   Next Topic Topic: Hey, Alright, Well

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use