bin/60636: Enhancement to adduser script.

wgrim at siue.edu wgrim at siue.edu
Sat Dec 27 13:40:17 PST 2003


>Number:         60636
>Category:       bin
>Synopsis:       Enhancement to adduser script.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sat Dec 27 13:40:12 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     William Michael Grim
>Release:        FreeBSD 5.1-RELEASE i386
>Organization:
Unix Network Administrator, CS Dept., SIUE
>Environment:
System: FreeBSD snow.cs.siue.edu 5.1-RELEASE FreeBSD 5.1-RELEASE #1: Fri Oct 10 12:06:11 CDT 2003 root at snow.cs.siue.edu:/usr/obj/usr/src/sys/SNOW i386


	Dual XEON-1.8GHz
	FreeBSD 5.1-RELEASE
>Description:
	I keep forgetting to change the default permissions on newly created
	home directories.  I figured it would be a good idea to allow adduser
	do this for users.  The user can enter the new permissions mode and
	adduser would give these permissions to the newly crated directory.

	BTW, this is a repeate of another PR I just sent in; I didn't set
	the From: and Reply-To: fields correctly; please feel free to delete it.
>How-To-Repeat:
	Create a new user with adduser and check the permissions of the newly
	created home directory.  The permissions are currently 0755.
>Fix:

	Let users write their own script or use the patch to adduser.sh and
	adduser.8 below.

--- adduser.sh.diff begins here ---
--- adduser.sh	Sat Dec 27 00:43:54 2003
+++ /usr/src/usr.sbin/adduser/adduser.sh	Sun Mar 23 17:06:44 2003
@@ -82,7 +82,6 @@
 	echo "  -L		login class of the user"
 	echo "  -N		do not read configuration file"
 	echo "  -d		home directory"
-	echo "  -o		home directory permissions (octal)"
 	echo "  -f		file from which input will be received"
 	echo "  -g		default login group"
 	echo "  -h		display this usage message"
@@ -152,7 +151,6 @@
 	echo "defaultgroups=$ugroups"	>> ${ADDUSERCONF}
 	echo "passwdtype=$passwdtype" 	>> ${ADDUSERCONF}
 	echo "homeprefix=$homeprefix" 	>> ${ADDUSERCONF}
-	echo "mode=$mode"		>> ${ADDUSERCONF}
 	echo "defaultshell=$ushell"	>> ${ADDUSERCONF}
 	echo "udotdir=$udotdir"		>> ${ADDUSERCONF}
 	echo "msgfile=$msgfile"		>> ${ADDUSERCONF}
@@ -271,9 +269,6 @@
 			info "Sent welcome message to ($username)."
 		}
 	fi
-
-	chmod $mode "$uhome";
-	info "Set permissions of ($uhome) to $mode.";
 }
 
 # get_user
@@ -387,21 +382,6 @@
 	fi
 }
 
-# get_mode
-#	Reads an octal number (permissions) in an interactive session or batch
-#	session.  Sets the user's new home directory to these permissions.
-#
-get_mode() {
-	_input=
-
-	echo -n "Home directory permissions [$mode]: "
-	read _input
-
-	if [ -n "$_input" ]; then
-		mode=$_input
-	fi
-}
-
 # get_uid
 #	Reads a numeric userid in an interactive or batch session. Automatically
 #	allocates one if it is not specified.
@@ -625,7 +605,6 @@
 	get_class
 	get_shell
 	get_homedir
-	get_mode
 
 	while : ; do
 		echo -n "Use password-based authentication? [$_usepass]: "
@@ -736,7 +715,6 @@
 	printf "%-10s : %s\n" "Class" "$uclass"
 	printf "%-10s : %s %s\n" "Groups" "${ulogingroup:-$username}" "$ugroups"
 	printf "%-10s : %s\n" "Home" "$uhome"
-	printf "%-10s : %s\n" "Home Perms" "$mode"
 	printf "%-10s : %s\n" "Shell" "$ushell"
 	printf "%-10s : %s\n" "Locked" "$_disable"
 	while : ; do
@@ -802,7 +780,6 @@
 defaultLgroup=
 defaultgoups=
 defaultshell="${DEFAULTSHELL}"
-mode=0751
 
 # Make sure the user running this program is root. This isn't a security
 # measure as much as it is a usefull method of reminding the user to
@@ -874,10 +851,6 @@
 	-d)
 		homeprefix="$2"
 		shift; shift
-		;;
-	-o)
-		mode="$2"
-		shift; shift;
 		;;
 	-m)
 		case "$2" in
--- adduser.sh.diff ends here ---

--- adduser.8.diff begins here ---
--- adduser.8	Sat Dec 27 00:43:54 2003
+++ /usr/src/usr.sbin/adduser/adduser.8	Thu Mar 20 10:36:03 2003
@@ -45,7 +45,6 @@
 .Op Fl s Ar shell
 .Op Fl u Ar uid_start
 .Op Fl w Ar type
-.Op Fl o Ar mode
 .Sh DESCRIPTION
 The
 .Nm
@@ -114,11 +113,6 @@
 You may choose an empty password, disable the password, use a
 randomly generated password or specify your own plaintext password,
 which will be encrypted before being stored in the user database.
-.It mode
-You may only use absolute or symbolic modes for home directory
-permissions; see
-.Xr chmod 1
-for more information.
 .El
 .Sh UNIQUE GROUPS
 Perhaps you are missing what
@@ -282,10 +276,6 @@
 .Va randompass
 variable.
 .El
-.It Fl o Ar mode
-Set the default permissions of a new home directory using modes
-specified in
-.Xr chmod 1 .
 .El
 .Sh FORMAT
 When the
--- adduser.8.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list