Lines Matching +full:uuid +full:- +full:dev
3 # SPDX-License-Identifier: BSD-2-Clause
5 # Copyright (c) 2002-2004 Michael Telahun Makonnen. All rights reserved.
35 if [ -z "$quietflag" ]; then
44 if [ -z "$quietflag" ]; then
58 if [ -z "$_uid" ]; then
59 _nextuid="$(${PWCMD} usernext | cut -f1 -d:)"
62 if ! ${PWCMD} usershow $_uid > /dev/null 2>&1; then
78 echo " -C save to the configuration file only"
79 echo " -D do not attempt to create the home directory"
80 echo " -E disable this account after creation"
81 echo " -G additional groups to add accounts to"
82 echo " -L login class of the user"
83 echo " -M file permission for home directory"
84 echo " -N do not read configuration file"
85 echo " -Z do not attempt to create ZFS home dataset"
86 echo " -S a nonexistent shell is not an error"
87 echo " -d home directory"
88 echo " -f file from which input will be received"
89 echo " -g default login group"
90 echo " -h display this usage message"
91 echo " -k path to skeleton home directory"
92 echo " -m user welcome message file"
93 echo " -q absolute minimal user feedback"
94 echo " -s shell"
95 echo " -u uid to start at"
96 echo " -w password type: no, none, yes or random"
108 echo -n "${_prefix}${_path##*/}"
113 [ -x "${NOLOGIN_PATH}" ] && echo -n " ${NOLOGIN}"
124 if [ -z "$_shell" ]; then
159 if [ -z "$(fullpath_from_shell "$_sh")" ] ; then
163 [ -x "$_sh" ] ||
202 if [ -n "$configflag" ]; then
207 _name="-n '$username'"
208 [ -n "$uuid" ] && _uid='-u "$uuid"'
209 [ -n "$ulogingroup" ] && _group='-g "$ulogingroup"'
210 [ -n "$ugroups" ] && _grouplist='-G "$ugroups"'
211 [ -n "$ushell" ] && _shell='-s "$ushell"'
212 [ -n "$uclass" ] && _class='-L "$uclass"'
213 [ -n "$ugecos" ] && _comment='-c "$ugecos"'
214 [ -n "$udotdir" ] && _dotdir='-k "$udotdir"'
215 [ -n "$uexpire" ] && _expire='-e "$uexpire"'
216 [ -n "$upwexpire" ] && _pwexpire='-p "$upwexpire"'
217 if [ -z "$Dflag" ] && [ -n "$uhome" ]; then
221 _home='-d "$uhome"'
224 if [ -n "$uhomeperm" ]; then
225 _home='-m -d "$uhome" -M "$uhomeperm"'
227 _home='-m -d "$uhome"'
230 elif [ -n "$Dflag" ] && [ -n "$uhome" ]; then
231 _home='-d "$uhome"'
235 _passwdmethod="-w no"
236 _passwd="-h -"
243 # the -r switch to the read command used to obtain the input.
245 _passwdmethod="-w yes"
246 _passwd="-h 0"
250 _passwdmethod="-w none"
253 _passwdmethod="-w random"
262 if [ -n "$BSDINSTALL_CHROOT" ]; then
287 if [ -n "$disableflag" ]; then
298 if [ -n "$BSDINSTALL_CHROOT" ]; then
304 if [ -n "$msgflag" ]; then
305 if [ -r "$msgfile" ]; then
313 _perms=$(/usr/bin/find "$_dir" -name "$_file" -perm +07022 -prune)
314 _owner=$(/usr/bin/find "$_dir" -name "$_file" -user 0 -prune)
315 if [ -z "$_owner" ] || [ -n "$_perms" ]; then
321 done <"$msgfile" | ${MAILCMD} -s"Welcome" ${username}
338 [ -n "$configflag" ] && return
341 if [ -z "$fflag" ]; then
342 echo -n "Username: "
345 _input="$(echo "$fileline" | cut -f1 -d:)"
352 if [ -z "$_input" ]; then
354 [ -z "$fflag" ] && continue
356 if ${PWCMD} usershow "$_input" > /dev/null 2>&1; then
358 [ -z "$fflag" ] && continue
373 [ -n "$configflag" ] && return
375 if [ -z "$fflag" ]; then
376 echo -n "Full name: "
379 _input="$(echo "$fileline" | cut -f7 -d:)"
394 if [ -z "$Sflag" ]; then
401 if [ -z "$fflag" ]; then
402 echo -n "Shell ($shells) [${ushell##*/}]: "
405 _input="$(echo "$fileline" | cut -f9 -d:)"
407 if [ -n "$_input" ]; then
408 if [ -n "$Sflag" ]; then
412 if [ -n "$_fullpath" ]; then
429 if [ -z "$fflag" ]; then
430 echo -n "Home directory [${homeprefix}/${username}]: "
433 _input="$(echo "$fileline" | cut -f8 -d:)"
436 if [ -n "$_input" ]; then
442 [ -z "$configflag" ] &&
457 if [ -n "$uhomeperm" ]; then
462 if [ -z "$fflag" ]; then
463 echo -n "$_prompt"
467 if [ -n "$_input" ]; then
481 if ! "$KLDSTATCMD" -q -m zfs; then
485 if ! _prefix=$(${ZFSCMD} list -Ho name "${homeprefix}" 2>/dev/null) ||
486 [ -z "${_prefix}" ]; then
492 _tmp=$(${ZFSCMD} list -Ho name "$(dirname "${homeprefix}")" 2>/dev/null)
506 uuid=${uidstart}
508 if [ -n "$uuid" ]; then
509 uuid=$(get_nextuid "$uuid")
510 _prompt="Uid [$uuid]: "
514 if [ -z "$fflag" ]; then
515 echo -n "$_prompt"
518 _input="$(echo "$fileline" | cut -f2 -d:)"
521 [ -n "$_input" ] && uuid=$_input
522 uuid=$(get_nextuid "$uuid")
523 uidstart=$uuid
532 _class=${uclass:-"default"}
534 if [ -z "$fflag" ]; then
535 echo -n "Login class [$_class]: "
538 _input="$(echo "$fileline" | cut -f4 -d:)"
541 [ -n "$_input" ] && uclass="$_input"
555 if [ -z "$fflag" ]; then
556 echo -n "Login group [${ulogingroup:-$username}]: "
559 _input="$(echo "$fileline" | cut -f3 -d:)"
563 [ -n "$_input" ] && ulogingroup="$_input"
573 _group=${ulogingroup:-"${username}"}
575 if [ -z "$configflag" ]; then
576 [ -z "$fflag" ] && echo -n "Login group is $_group. Invite $username"
577 [ -z "$fflag" ] && echo -n " into other groups? [$ugroups]: "
579 [ -z "$fflag" ] && echo -n "Enter additional groups [$ugroups]: "
583 [ -n "$_input" ] && ugroups="$_input"
591 upwexpire="$(echo "$fileline" | cut -f5 -d:)"
592 uexpire="$(echo "$fileline" | cut -f6 -d:)"
607 if [ -n "$savedpwtype" ]; then
615 if [ -z "$upass" ]; then
640 echo -n "$_prompt"
643 [ -z "$_input" ] && _input=$Zencrypt
661 zfsopt="-o encryption=on -o keylocation=prompt -o keyformat=passphrase"
669 if ! ${ZFSCMD} create -u ${zfsopt} "${zhome}"; then
674 ${MKDIRCMD} -p "${uhome}"
675 ${MOUNTCMD} -t zfs "${zhome}" "${uhome}"
715 while read -r fileline ; do
773 if [ -n "$ulogingroup" ] && [ "$username" != "$ulogingroup" ]; then
774 if ! ${PWCMD} show group $ulogingroup > /dev/null 2>&1; then
785 if ! ${PWCMD} show group $i > /dev/null 2>&1; then
801 echo -n "Use password-based authentication? [$_usepass]: "
803 [ -z "$_input" ] && _input=$_usepass
810 echo -n "Use an empty password? (yes/no) [$_emptypass]: "
812 [ -n "$_input" ] && _emptypass=$_input
815 echo -n "Use a random password? (yes/no) [$_random]: "
817 [ -n "$_input" ] && _random="$_input"
825 [ -n "$configflag" ] && break
827 stty -echo
828 echo -n "Enter password: "
829 IFS= read -r upass
831 echo -n "Enter password again: "
832 IFS= read -r _passconfirm
837 [ -z "$upass$_passconfirm" ] && continue
862 _disable=${disableflag:-"no"}
864 echo -n "Lock out the account after creation? [$_disable]: "
866 [ -z "$_input" ] && _input=$_disable
885 _disable=${disableflag:-"no"}
886 [ -z "$configflag" ] && printf "%-11s : %s\n" Username $username
901 [ -z "$configflag" ] && printf "%-11s : %s\n" "Password" "$_pass"
902 [ -n "$configflag" ] && printf "%-11s : %s\n" "Pass Type" "$passwdtype"
903 [ -z "$configflag" ] && printf "%-11s : %s\n" "Full Name" "$ugecos"
904 [ -z "$configflag" ] && printf "%-11s : %s\n" "Uid" "$uuid"
905 [ "$Zcreate" = "yes" ] && [ -z "$configflag" ] &&
906 printf "%-11s : %s\n" "ZFS dataset" "${zhome}"
907 [ "$Zencrypt" = "yes" ] && [ -z "$configflag" ] &&
908 printf "%-11s : %s\n" "Encrypted" "${Zencrypt}"
909 printf "%-11s : %s\n" "Class" "$uclass"
910 printf "%-11s : %s %s\n" "Groups" "${ulogingroup:-$username}" "$ugroups"
911 printf "%-11s : %s\n" "Home" "$uhome"
912 printf "%-11s : %s\n" "Home Mode" "$uhomeperm"
913 printf "%-11s : %s\n" "Shell" "$ushell"
914 printf "%-11s : %s\n" "Locked" "$_disable"
916 echo -n "OK? (yes/no) [$_all_ok]: "
918 if [ -z "$_input" ]; then
941 ADDUSERCONF="${ADDUSERCONF:-/etc/adduser.conf}"
942 PWCMD="${PWCMD:-/usr/sbin/pw}"
943 MAILCMD="${MAILCMD:-mail}"
944 ETCSHELLS="${ETCSHELLS:-/etc/shells}"
959 uuid=
999 # 'su -' before he/she wastes time entering data that won't be saved.
1001 procowner=${procowner:-$(/usr/bin/id -u)}
1003 err 'you must be the super-user (uid 0) to use this utility.'
1014 if [ "$_i" = "-N" ]; then
1019 if [ -n "$readconfig" ] && [ -r "${ADDUSERCONF}" ]; then
1023 # Process command-line options
1027 -L)
1031 -C)
1035 -D)
1039 -E)
1043 -k)
1047 -f)
1048 [ "$2" != "-" ] && infile="$2"
1052 -g)
1056 -G)
1060 -h)
1064 -d)
1068 -m)
1080 -M)
1084 -N)
1088 -w)
1100 -q)
1104 -s)
1108 -S)
1112 -u)
1116 -Z)
1123 # If the -f switch was used, get input from a file. Otherwise,
1126 if [ -n "$fflag" ]; then
1127 if [ -z "$infile" ]; then
1129 elif [ -n "$infile" ]; then
1130 if [ -r "$infile" ]; then
1140 if [ -z "$configflag" ]; then
1141 echo -n "Add another user? (yes/no) [$_another_user]: "
1143 echo -n "Re-edit the default configuration? (yes/no) [$_another_user]: "
1146 if [ -z "$_input" ]; then