Skip to Content.
Sympa Menu

sm-discuss - [SM-Discuss] shadow's adduser sucks

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: Eric Sandall <eric AT sandall.us>
  • To: sm-discuss AT lists.ibiblio.org
  • Subject: [SM-Discuss] shadow's adduser sucks
  • Date: Sat, 28 May 2005 20:35:12 -0700

Hey all,

I've been playing with /etc/default/useradd (to set defaults for
useradd), but I wanted to use adduser as that'll setup /home and
/var/spool/mail. I figured that since adduser uses useradd it'd use
useradd's defaults (as defined in /etc/default/useradd), but no, the
adduser script uses it's own default for group and shell (my main beef
with it). So attached is a patch that I'd like to have optionally
applied to shadow so that it uses the defaults for group and shell
(other defaults should probably be added, which I can do as well if you
want).

-sandalle

--
Eric Sandall | Source Mage GNU/Linux Developer
eric at sandall.us PGP: 0xA8EFDD61 | http://www.sourcemage.org/
http://eric.sandall.us/ | SysAdmin @ Inst. Shock Physics @
WSU
http://counter.li.org/ #196285 | http://www.shock.wsu.edu/

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
--- adduser.orig	2005-05-28 20:26:18.000000000 -0700
+++ adduser	2005-05-28 20:26:18.000000000 -0700
@@ -8,8 +8,13 @@
     NEWSER=$1
   fi
 
-  groupadd     $NEWSER
-  useradd  -m  $NEWSER  -g  $NEWSER -s /bin/bash
+  if  [  -f  /etc/default/useradd  ];  then
+    source  /etc/default/useradd  &&
+    useradd  -m  $NEWSER  -g  $GROUP -s $SHELL
+  else
+    groupadd     $NEWSER
+    useradd  -m  $NEWSER  -g  $NEWSER -s /bin/bash
+  fi  &&
 
   touch                 /var/spool/mail/$NEWSER
   chown   $NEWSER:mail  /var/spool/mail/$NEWSER



Archive powered by MHonArc 2.6.24.

Top of Page