From owner-freebsd-bugs@FreeBSD.ORG Sat Dec 27 13:40:17 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F213516A4CE for ; Sat, 27 Dec 2003 13:40:16 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id AFF9943D39 for ; Sat, 27 Dec 2003 13:40:12 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) hBRLeCFR075837 for ; Sat, 27 Dec 2003 13:40:12 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id hBRLeC9n075836; Sat, 27 Dec 2003 13:40:12 -0800 (PST) (envelope-from gnats) Resent-Date: Sat, 27 Dec 2003 13:40:12 -0800 (PST) Resent-Message-Id: <200312272140.hBRLeC9n075836@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "wgrim@siue.edu" Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4E11516A4CE for ; Sat, 27 Dec 2003 13:30:55 -0800 (PST) Received: from snow.cs.siue.edu (snow.cs.siue.edu [146.163.150.15]) by mx1.FreeBSD.org (Postfix) with ESMTP id 82B3843D1F for ; Sat, 27 Dec 2003 13:30:51 -0800 (PST) (envelope-from unix@snow.cs.siue.edu) Received: from snow.cs.siue.edu (22117ad747f04cd862a84afb5133eb89@localhost [127.0.0.1]) by snow.cs.siue.edu (8.12.9/8.12.9) with ESMTP id hBRLPKBK099579 for ; Sat, 27 Dec 2003 15:25:20 -0600 (CST) (envelope-from unix@snow.cs.siue.edu) Received: (from unix@localhost) by snow.cs.siue.edu (8.12.9/8.12.9/Submit) id hBRLPKLK099578; Sat, 27 Dec 2003 15:25:20 -0600 (CST) Message-Id: <200312272125.hBRLPKLK099578@snow.cs.siue.edu> Date: Sat, 27 Dec 2003 15:25:20 -0600 (CST) From: wgrim@siue.edu To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/60636: Enhancement to adduser script. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: "wgrim@siue.edu" List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Dec 2003 21:40:17 -0000 >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@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: