[luau] adding new users

Nakashima pnakashi at k12.hi.us
Wed Sep 17 16:56:01 PDT 2003


Hi all,
Non-techie here. I've only written two or three scripts so far and I need
some help. I'm very new to this so please speak slowly and in English.

The below script is intended to add a new user to our LTSP system.
Most of it works, but I can't get useradd -g -G to work.

Even if I try to add the user to his own primary group and also to his
class group, when I look at the results, the user is not in those groups.

Is there an error in my script? Maybe where I set the GROUPS variable?

As a work-around, is there a way to assign users to groups in a separate
command?

TIA

--

 Peter Nakashima
 Computer Teacher
 Liholiho Elementary

--

#!/bin/sh

# Set variable USERNAME
echo Type new username below in lowercase then press ENTER.
read USERNAME

# Set variable GROUPS
echo Type a comma separated list of groups with no spaces then press
ENTER.
read GROUPS

# create the user's primary group
# -f means to fail if group is not unique
groupadd $USERNAME -f

# create the user
# -f-1 means to not have account expire
useradd $USERNAME -g$USERNAME -G$GROUPS -f-1 -m

# Add the "File Server" link in the new user's home directory
ln -s /var/fileserver /home/$USERNAME/File\ Server

# Set password to temppass
# Set password aging
echo "temppass" | passwd -n 9999 -x 9999 -w 7 -i 9999 $USERNAME --stdin

echo Press ENTER to end
read END_SCRIPT





More information about the LUAU mailing list