tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* adduser script, the UID doesn't work, help...
@ 2000-10-15 11:06 Steve
  0 siblings, 0 replies; only message in thread
From: Steve @ 2000-10-15 11:06 UTC (permalink / raw)
  To: tru64-unix-managers

Hello

I've managed to create an adduser script,  but it seems that UID cannot
be written to /etc/passwd
I've tried any ways I could think of, but I still cannot find the way to
solve the problem....
anybody can help me out of this mess??

thanx

Steve


#!/bin/sh
echo
echo -n "Please insert login name (max 8 character): "
read LGN
if [ -z "$LGN" ]
 then
 echo "Error, You must fill the login field...";
exit
fi
pass="/etc/passwd"
cat $pass | awk -F: '{print $1}' >pass.1
if cat pass.1 | grep "\<"$LGN"\>"; then
 echo "Login is already exist";
 exit
fi
rm pass.1

echo
echo -n "Please insert User ID : "
read ID
GUID="-u $ID"
if [ -z "$ID" ]
 then
 GUID=""
fi
echo
echo -n "Please insert Group ID : "
read GID
if [ -z "$GID" ]
 then
      GID="users"
fi
GGID="-g $GID"
echo
echo -n "Please specify $LGN's home directory [eg. /home/$LGN]: "
read HMD
if [ -z "$HMD" ]; then
     HMD="/home/$LGN"
fi
GHMD="-d $HMD"
echo
echo -n "Please specify $LGN's shell [eg. /bin/bash]: "
read SHL
GSHL="-s $SHL"
if [ -z "$SHL" ]
 then
 GSHL="-s /bin/bash"
      SHL="/bin/bash"
fi
echo
echo "Creating new account for $LGN"
echo "Adding username $LGN"
echo "Creating User ID for $LGN"
echo "Creating Group ID for $LGN"
echo "Creating Home Directory : $HMD"
echo "Creating Shell : $SHL"
echo
echo New login name: $LGN
if [ -z "$GUID" ]
then echo New UID: [Next available]
else echo New UID: $UID
fi
if [ -z "$GGID" ]
then echo Initial group: Users
else echo Initial group: $GID
fi
if [ -z "$GHME" ]
then echo Home directory: /home/$LGN
else echo Home directory: $HME
fi
if [ -z "$GSHL" ]
then echo Shell: /bin/bash
else echo Shell: $SHL
fi

echo
echo $LGN ":x:" $UID ":" $GID ":" $AGID ":" $HMD ":" $SHL>>$pass
echo
mkdir $HMD
chown $UID $HMD
chgrp $GID $HMD

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-10-15 11:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-10-15 11:06 adduser script, the UID doesn't work, help Steve

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox