From owner-freebsd-bugs@FreeBSD.ORG Sat Dec 27 13:30:21 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 9FF5016A4CE for ; Sat, 27 Dec 2003 13:30:21 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0959D43D45 for ; Sat, 27 Dec 2003 13:30:17 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) hBRLUGFR073931 for ; Sat, 27 Dec 2003 13:30:16 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id hBRLUGZW073930; Sat, 27 Dec 2003 13:30:16 -0800 (PST) (envelope-from gnats) Resent-Date: Sat, 27 Dec 2003 13:30:16 -0800 (PST) Resent-Message-Id: <200312272130.hBRLUGZW073930@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, "SIUE non-NIS acct." Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B825016A4CE for ; Sat, 27 Dec 2003 13:22:35 -0800 (PST) Received: from snow.cs.siue.edu (snow.cs.siue.edu [146.163.150.15]) by mx1.FreeBSD.org (Postfix) with ESMTP id C4F1143D53 for ; Sat, 27 Dec 2003 13:22:33 -0800 (PST) (envelope-from unix@snow.cs.siue.edu) Received: from snow.cs.siue.edu (60c4e1e2291d6c842ff56d73a9b52ce7@localhost [127.0.0.1]) by snow.cs.siue.edu (8.12.9/8.12.9) with ESMTP id hBRLH2BK099463 for ; Sat, 27 Dec 2003 15:17:03 -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 hBRLH20x099462; Sat, 27 Dec 2003 15:17:02 -0600 (CST) Message-Id: <200312272117.hBRLH20x099462@snow.cs.siue.edu> Date: Sat, 27 Dec 2003 15:17:02 -0600 (CST) From: "SIUE non-NIS acct." To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/60635: Enhanced adduser script allowing different homedir create permissions. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: "SIUE non-NIS acct." List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Dec 2003 21:30:21 -0000 >Number: 60635 >Category: bin >Synopsis: Enhanced adduser script allowing different homedir create permissions. >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:30:16 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: Before, when using adduser, I became frustrated with the fact that home directories were created with mode 0755 when I wanted 0751. I kept forgetting to set permissions and decided to fix adduser to do this for me. I figured it could help others as well. >How-To-Repeat: Run the current adduser utility and then view the permissions to the newly created home directory. Currently, they're 0755. >Fix: You could either let users write their own script in addition to adduser so that it changes the permissions after adding a user, or this patch could be applied, letting a user choose home directory permissions on-the-fly (in case they're forgetful like me). Patches for adduser.sh and adduser.8 are included here. --- 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: