From owner-freebsd-bugs@FreeBSD.ORG Thu Nov 2 07:50:24 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org 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 0DCF116A4D1 for ; Thu, 2 Nov 2006 07:50:24 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1BDFF43D78 for ; Thu, 2 Nov 2006 07:50:22 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id kA27oLux010984 for ; Thu, 2 Nov 2006 07:50:21 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id kA27oLsx010978; Thu, 2 Nov 2006 07:50:21 GMT (envelope-from gnats) Resent-Date: Thu, 2 Nov 2006 07:50:21 GMT Resent-Message-Id: <200611020750.kA27oLsx010978@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, "Dr. Markus Waldeck" Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ED14A16A40F for ; Thu, 2 Nov 2006 07:48:20 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4E8CD43D8D for ; Thu, 2 Nov 2006 07:48:14 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id kA27mETV010972 for ; Thu, 2 Nov 2006 07:48:14 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id kA27mEjq010971; Thu, 2 Nov 2006 07:48:14 GMT (envelope-from nobody) Message-Id: <200611020748.kA27mEjq010971@www.freebsd.org> Date: Thu, 2 Nov 2006 07:48:14 GMT From: "Dr. Markus Waldeck" To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.0 Cc: Subject: bin/105060: adduser does not support the setting of the mode of the home directory X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Nov 2006 07:50:24 -0000 >Number: 105060 >Category: bin >Synopsis: adduser does not support the setting of the mode of the home directory >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Nov 02 07:50:21 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Dr. Markus Waldeck >Release: 6.1 >Organization: >Environment: FreeBSD fb 6.1-RELEASE FreeBSD 6.1-RELEASE #0: Sun May 7 04:32:43 UTC 2006 root@opus.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 >Description: There is not possibility to set the mode of the home directory when a new user is created. >How-To-Repeat: >Fix: This patch requires the patch which is included in PR bin/104248! diff -ru adduser.orig/adduser.8 adduser/adduser.8 --- adduser.orig/adduser.8 Wed Aug 23 07:46:15 2006 +++ adduser/adduser.8 Wed Nov 1 20:13:27 2006 @@ -35,6 +35,7 @@ .Sh SYNOPSIS .Nm .Op Fl CDENShq +.Op Fl A Ar mode .Op Fl G Ar groups .Op Fl L Ar login_class .Op Fl d Ar partition @@ -157,6 +158,8 @@ any values saved in this file. .Sh OPTIONS .Bl -tag -width indent +.It Fl A Ar mode +Set file permission for the home directory. .It Fl C Create new configuration file and exit. This option is mutually exclusive with the diff -ru adduser.orig/adduser.sh adduser/adduser.sh --- adduser.orig/adduser.sh Wed Aug 23 07:46:15 2006 +++ adduser/adduser.sh Wed Nov 1 20:43:35 2006 @@ -76,6 +76,7 @@ show_usage() { echo "usage: ${THISCMD} [options]" echo " options may include:" + echo " -A file permission for home directory" echo " -C save to the configuration file only" echo " -D do not attempt to create the home directory" echo " -E disable this account after creation" @@ -195,6 +196,7 @@ echo "defaultgroups=$ugroups" >> ${ADDUSERCONF} echo "passwdtype=$passwdtype" >> ${ADDUSERCONF} echo "homeprefix=$homeprefix" >> ${ADDUSERCONF} + echo "homemode=$homemode" >> ${ADDUSERCONF} echo "defaultshell=$ushell" >> ${ADDUSERCONF} echo "udotdir=$udotdir" >> ${ADDUSERCONF} echo "msgfile=$msgfile" >> ${ADDUSERCONF} @@ -246,10 +248,10 @@ if [ "$uhome" = "$NOHOME" ]; then _home='-d "$uhome"' else - _home='-m -d "$uhome"' + _home='-m -d "$uhome" -A $uhomemode' fi elif [ -n "$Dflag" -a -n "$uhome" ]; then - _home='-d "$uhome"' + _home='-d "$uhome" -A $uhomemmode' fi case $passwdtype in no) @@ -442,6 +444,28 @@ fi } +# get_homemode +# Reads the account's home directory file permission. Used both with interactive input +# and batch input. In batch mode the value in /etc/adduser.conf if present or 0755 +# is used. +# +get_homemode() { + _input= + uhomemode="$homemode" + + if [ -z "$fflag" ]; then + echo -n "Home directory file permission [${uhomemode}]: " + read _input + else + _input=${uhomemode} + fi + + if [ -n "$_input" ]; then + uhomemode="$_input" + homemode="$uhomemode" + fi +} + # get_uid # Reads a numeric userid in an interactive or batch session. Automatically # allocates one if it is not specified. @@ -601,6 +625,7 @@ get_class get_shell get_homedir + get_homemode get_password get_expire_dates @@ -667,6 +692,7 @@ get_class get_shell get_homedir + get_homemode while : ; do echo -n "Use password-based authentication? [$_usepass]: " @@ -777,6 +803,7 @@ 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 Mode" "$uhomemode" printf "%-10s : %s\n" "Shell" "$ushell" printf "%-10s : %s\n" "Locked" "$_disable" while : ; do @@ -821,6 +848,7 @@ ulogingroup= uclass= uhome= +uhomemode=0755 upass= ushell= udotdir=/usr/share/skel >Release-Note: >Audit-Trail: >Unformatted: