[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

RE: ADDUSER command.



> 	I have a doubt regarding the "ADDUSER" command. In
> Slackware, creating a
> user using the "adduser" command in textmode is a simple process of
> answering some basic questions and at the end, the user is created. In
> Redhat, creating a user using the "adduser" or "useradd" command in
> textmode needs some command line parameters and it is a little
> bit tedious.

In fact RedHat's adduser/useradd behaviour is completely correct and in line
with the basic tenets of Unix - small tools that do one thing and do it
well. When combined with various other such tools, it allows the building of
a system as powerful as Linux.

Slackware's adduser is completely interactive and cannot be scripted - bad
news.

If you really want that functionality, a small script combining adduser and
passwd will happily do the job for you - a clear example of what Unix is all
about.

#!/bin/sh
# Disclaimer - I am writing this on the fly
# and have not tested it - AC
#
echo -n "Enter user id: "
if [ "$#" = "0" ]; then
   read auUserID
else
   auUserID=$1
   echo $auUserID
fi
useradd $auUserID
if [ "$?" = "0" ]; then
   echo -n "Enter user name: "
   read auUserName
   chfn -f "$auUserName" $auUserID
   passwd $auUserID
   chsh $auUserID
fi
finger $auUserID
# eof

If you need to add other functionality, add more echo/read pairs for office,
office-phone, home-phone. Check "man chfn" for details.

Atul


- --------------------------------------------------------------------
To unsubscribe send an email to majordomo@xxxxxxxxx with the word
'unsubscribe linux-india' (without the quotes) in the body of the email.

------------------------------