Apply patches from PR bin/24695 by Peter Postma:

The changes are:

        * rename "Security and Users" to "Users and Groups"
        * use default settings in /etc/usermgmt.conf (if it exists)
          when adding a new user.
        * fix output for 'List users'.
        * add the following menu's: Modify user, Change password, Add group,
          List groups, Delete group.
This commit is contained in:
garbled 2004-03-09 20:06:42 +00:00
parent 337520b409
commit 52b2cb6a03
30 changed files with 241 additions and 25 deletions

View File

@ -1,7 +1,7 @@
# $NetBSD: index,v 1.5 2001/04/26 02:26:16 garbled Exp $
# $NetBSD: index,v 1.6 2004/03/09 20:06:42 garbled Exp $
install install Software Installation and Maintenance
system system System Maintenance
users users Security and Users
users users Users and Groups
procs procs Processes and Daemons
network network Network related configuration
BLANK BLANK BLANK

View File

@ -1,6 +1,7 @@
# $NetBSD: Makefile,v 1.2 2001/12/12 01:49:31 tv Exp $
# $NetBSD: Makefile,v 1.3 2004/03/09 20:06:42 garbled Exp $
SUBDIR= adduser deluser disuser listuser
SUBDIR= adduser deluser disuser listuser addgroup delgroup listgroup
SUBDIR+= moduser passwd
FILES= index
FILESDIR=${BINDIR}/sushi/users

View File

@ -0,0 +1,10 @@
# $NetBSD: Makefile,v 1.1 2004/03/09 20:06:42 garbled Exp $
FILES= form
FILESDIR=${BINDIR}/sushi/users/addgroup
SCRIPTS= script
SCRIPTSDIR=${BINDIR}/sushi/users/addgroup
NOOBJ= # defined
.include "../../../Makefile.inc"
.include <bsd.prog.mk>

View File

@ -0,0 +1,3 @@
# $NetBSD: form,v 1.1 2004/03/09 20:06:42 garbled Exp $
req-entry:8, Group
integer:6,0,32767 Group ID

View File

@ -0,0 +1,13 @@
#!/bin/sh
# $NetBSD: script,v 1.1 2004/03/09 20:06:42 garbled Exp $
if [ -z "$2" ]; then
GID=""
else
GID="-g $2"
fi
groupadd -v $GID $1
if [ $? -eq 0 ]; then
echo "Group $1 successfully created"
fi

View File

@ -1,4 +1,4 @@
# $NetBSD: form,v 1.1 2001/01/05 02:07:00 garbled Exp $
# $NetBSD: form,v 1.2 2004/03/09 20:06:42 garbled Exp $
req-entry:8, Username
script:script1 Primary group
script:script3 Secondary group
@ -6,4 +6,4 @@ entry:30, User's real name
entry:50, User's home directory
integer:4,0,2000 Days before password expires
script:script2 User's login shell
integer:6,0,32767 User's UID.
integer:6,0,32767 User's UID

View File

@ -1,13 +1,20 @@
#!/bin/sh -x
# $NetBSD: script,v 1.1 2001/01/05 02:07:00 garbled Exp $
CTIME=`date +%s`
if [ ! -z $6 ]; then
#!/bin/sh
# $NetBSD: script,v 1.2 2004/03/09 20:06:42 garbled Exp $
if [ -n "$6" ]; then
CTIME=`date +%s`
EXPIRE=`expr $6 \* 24 \* 60 \* 60 + $CTIME`
EXPIRE=`echo "-e $EXPIRE"`
fi
if [ -z $5 ]; then
HOME=`grep base_dir /etc/usermgmt.conf | awk '{print $2}'`
HOME=`echo "${HOME}/${1}"`
if [ -r "/etc/usermgmt.conf" ]; then
BASE=`grep base_dir /etc/usermgmt.conf | awk '{print $2}'`
fi
if [ -n "$BASE" ]; then
HOME=`echo "${BASE}/${1}"`
else
HOME=`echo "/home/${1}"`
fi
else
HOME=$5
fi

View File

@ -1,3 +1,12 @@
#!/bin/sh
# $NetBSD: script1,v 1.1 2001/01/05 02:07:00 garbled Exp $
cut -f 1 -d ':' /etc/group
# $NetBSD: script1,v 1.2 2004/03/09 20:06:42 garbled Exp $
if [ -r "/etc/usermgmt.conf" ]; then
FIRST=`grep 'group' /etc/usermgmt.conf | awk '{print $2}'`
fi
if [ -n "$FIRST" ]; then
echo $FIRST
cut -f 1 -d ':' /etc/group | grep -v "$FIRST"
else
cut -f 1 -d ':' /etc/group
fi

View File

@ -1,3 +1,12 @@
#!/bin/sh
# $NetBSD: script2,v 1.1 2001/01/05 02:07:00 garbled Exp $
egrep -v '(^#|^$)' /etc/shells
# $NetBSD: script2,v 1.2 2004/03/09 20:06:42 garbled Exp $
if [ -r "/etc/usermgmt.conf" ]; then
FIRST=`grep 'shell' /etc/usermgmt.conf | awk '{print $2}'`
fi
if [ -n "$FIRST" ]; then
echo $FIRST
egrep -v '(^#|^$)' /etc/shells | grep -v "$FIRST"
else
egrep -v '(^#|^$)' /etc/shells
fi

View File

@ -1,4 +1,5 @@
#!/bin/sh
# $NetBSD: script3,v 1.1 2001/01/05 02:07:00 garbled Exp $
# $NetBSD: script3,v 1.2 2004/03/09 20:06:42 garbled Exp $
echo "NONE"
cut -f 1 -d ':' /etc/group

View File

@ -0,0 +1,10 @@
# $NetBSD: Makefile,v 1.1 2004/03/09 20:06:42 garbled Exp $
FILES= form
FILESDIR=${BINDIR}/sushi/users/delgroup
SCRIPTS= script script1
SCRIPTSDIR=${BINDIR}/sushi/users/delgroup
NOOBJ= # defined
.include "../../../Makefile.inc"
.include <bsd.prog.mk>

View File

@ -0,0 +1,2 @@
# $NetBSD: form,v 1.1 2004/03/09 20:06:42 garbled Exp $
script:script1 Group to delete?

View File

@ -0,0 +1,7 @@
#!/bin/sh
# $NetBSD: script,v 1.1 2004/03/09 20:06:42 garbled Exp $
groupdel -v $1
if [ $? -eq 0 ]; then
echo "Group $1 deleted"
fi

View File

@ -0,0 +1,3 @@
#!/bin/sh
# $NetBSD: script1,v 1.1 2004/03/09 20:06:42 garbled Exp $
cut -f1 -d: /etc/group

View File

@ -1,4 +1,3 @@
#!/bin/sh
# $NetBSD: script1,v 1.1 2001/01/05 02:07:00 garbled Exp $
# $NetBSD: script1,v 1.2 2004/03/09 20:06:42 garbled Exp $
cut -f 1 -d ':' /etc/passwd

View File

@ -1,4 +1,3 @@
#!/bin/sh
# $NetBSD: script1,v 1.1 2001/01/05 02:07:01 garbled Exp $
# $NetBSD: script1,v 1.2 2004/03/09 20:06:42 garbled Exp $
cut -f 1 -d ':' /etc/passwd

View File

@ -1,5 +1,11 @@
# $NetBSD: index,v 1.1 2001/01/05 02:06:59 garbled Exp $
# $NetBSD: index,v 1.2 2004/03/09 20:06:42 garbled Exp $
listuser listuser List users on this system
adduser adduser Add a new user to the system
deluser deluser Delete a user on the system
disuser disableuser Disable a user on the system
moduser moduser Modify a user on the system
passwd passwd Set/change the password of a user
BLANK BLANK BLANK
listgroup listgroup List groups on this system
addgroup addgroup Add a new group to the system
delgroup delgroup Delete a group on the system

View File

@ -0,0 +1,8 @@
# $NetBSD: Makefile,v 1.1 2004/03/09 20:06:42 garbled Exp $
SCRIPTS= script
SCRIPTSDIR=${BINDIR}/sushi/users/listgroup
NOOBJ= # defined
.include "../../../Makefile.inc"
.include <bsd.prog.mk>

View File

@ -0,0 +1,17 @@
#!/bin/sh
# $NetBSD: script,v 1.1 2004/03/09 20:06:42 garbled Exp $
cat /etc/group | awk ' \
BEGIN { \
FS=":"; \
print "Groupname GID Members" \
} \
{ \
gsub("&", $1); \
printf("%s", $1);
for (x=length($1); x < 20; x++ ) \
printf(" "); \
printf("%7d", $3); \
for (x=length($3); x < 14; x++ ) \
printf(" "); \
printf("%s\n", $4); \
}'

View File

@ -1,9 +1,10 @@
#!/bin/sh
# $NetBSD: script,v 1.1 2001/01/05 02:07:01 garbled Exp $
# $NetBSD: script,v 1.2 2004/03/09 20:06:42 garbled Exp $
cat /etc/passwd | awk ' \
BEGIN { \
FS=":"; \
print "Username Real name UID" \
print "Username Real name \
UID" \
} \
{ \
gsub("&", $1); \
@ -11,7 +12,7 @@ cat /etc/passwd | awk ' \
for (x=length($1); x < 12; x++ ) \
printf(" "); \
printf("%s", $5); \
for (x=length($5); x < 30; x++ ) \
for (x=length($5); x < 40; x++ ) \
printf(" "); \
printf("%7d\n", $3); \
}'

View File

@ -0,0 +1,10 @@
# $NetBSD: Makefile,v 1.1 2004/03/09 20:06:42 garbled Exp $
FILES= preform form
FILESDIR=${BINDIR}/sushi/users/moduser
SCRIPTS= script script1 script2
SCRIPTSDIR=${BINDIR}/sushi/users/moduser
NOOBJ= # defined
.include "../../../Makefile.inc"
.include <bsd.prog.mk>

View File

@ -0,0 +1,9 @@
# $NetBSD: form,v 1.1 2004/03/09 20:06:42 garbled Exp $
noedit:@@@1@@@ Username
script:script2,@@@1@@@,1stgroup Primary group
script:script2,@@@1@@@,2ndgroup Secondary group
escript:30,script2,@@@1@@@,realname User's real name
escript:50,script2,@@@1@@@,homedir User's home directory
iscript:5,0,2000,script2,@@@1@@@,expire Days before password expires
script:script2,@@@1@@@,shell User's login shell
iscript:6,0,32767,script2,@@@1@@@,uid User's UID

View File

@ -0,0 +1,2 @@
# $NetBSD: preform,v 1.1 2004/03/09 20:06:42 garbled Exp $
script:script1 User to modify?

View File

@ -0,0 +1,26 @@
#!/bin/sh
# $NetBSD: script,v 1.1 2004/03/09 20:06:42 garbled Exp $
if [ -n "$6" -a "$6" != "NEVER" ]; then
CTIME=`date +%s`
EXPIRE=`expr $6 \* 24 \* 60 \* 60 + $CTIME`
EXPIRE=`echo "-e $EXPIRE"`
fi
ID=`id -u $1`
if [ $8 -eq $ID ]; then
UID=""
else
UID="-u $8"
fi
if [ -z $3 ]; then
SG=""
else
SG="-G $3"
fi
usermod -g $2 $SG -c "$4" -d "$5" $EXPIRE -s $7 $UID -v $1
if [ $? -eq 0 ]; then
echo "User $1 successfully modified."
fi

View File

@ -0,0 +1,3 @@
#!/bin/sh
# $NetBSD: script1,v 1.1 2004/03/09 20:06:42 garbled Exp $
cut -f1 -d':' /etc/passwd

View File

@ -0,0 +1,43 @@
#!/bin/sh
# $NetBSD: script2,v 1.1 2004/03/09 20:06:42 garbled Exp $
if [ -z "$1" -o -z "$2" ]; then
exit 1
fi
if [ "$2" = "uid" ]; then
userinfo $1 | grep 'uid' | awk '{print $2}'
fi
if [ "$2" = "1stgroup" ]; then
FIRST=`userinfo $1 | grep 'groups' | awk '{print $2}'`
echo "$FIRST"
cut -f1 -d':' /etc/group | grep -v "$FIRST"
fi
if [ "$2" = "2ndgroup" ]; then
FIRST=`userinfo $1 | grep 'groups' | awk '{print $3}'`
if [ -z "$FIRST" ]; then
FIRST=" "
fi
echo "$FIRST"
cut -f1 -d':' /etc/group | grep -v "$FIRST"
fi
if [ "$2" = "realname" ]; then
userinfo $1 | grep 'gecos' | sed 's/gecos //g' | sed 's/,//g'
fi
if [ "$2" = "homedir" ]; then
userinfo $1 | grep 'dir' | awk '{print $2}'
fi
if [ "$2" = "shell" ]; then
FIRST=`userinfo $1 | grep 'shell' | awk '{print $2}'`
echo $FIRST
egrep -v '(^#|^$)' /etc/shells | grep -v "$FIRST"
fi
if [ "$2" = "expire" ]; then
userinfo $1 | grep 'expire' | awk '{print $2}'
fi

View File

@ -0,0 +1,10 @@
# $NetBSD: Makefile,v 1.1 2004/03/09 20:06:42 garbled Exp $
FILES= form
FILESDIR=${BINDIR}/sushi/users/passwd
SCRIPTS= script script1
SCRIPTSDIR=${BINDIR}/sushi/users/passwd
NOOBJ= # defined
.include "../../../Makefile.inc"
.include <bsd.prog.mk>

View File

@ -0,0 +1,2 @@
# $NetBSD: form,v 1.1 2004/03/09 20:06:42 garbled Exp $
script:script1 User to change password?

View File

@ -0,0 +1,3 @@
#!/bin/sh
# $NetBSD: script,v 1.1 2004/03/09 20:06:42 garbled Exp $
passwd $1

View File

@ -0,0 +1,3 @@
#!/bin/sh
# $NetBSD: script1,v 1.1 2004/03/09 20:06:42 garbled Exp $
cut -f1 -d: /etc/passwd