Date: Thu, 2 Nov 2006 07:48:14 GMT From: "Dr. Markus Waldeck"<waldeck@gmx.de> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/105060: adduser does not support the setting of the mode of the home directory Message-ID: <200611020748.kA27mEjq010971@www.freebsd.org> Resent-Message-ID: <200611020750.kA27oLsx010978@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200611020748.kA27mEjq010971>