add_new_user.sh; fix some errors.
This commit is contained in:
parent
c4e91648fd
commit
3a03296fa0
@ -78,9 +78,11 @@ if ! id -u "${user_name}" > /dev/null 2>&1 ; then
|
|||||||
cp -a "${skel_dir}/.profile" "${home_base_dir}/${user_name}/"
|
cp -a "${skel_dir}/.profile" "${home_base_dir}/${user_name}/"
|
||||||
chown ${user_name}:${user_name} "${home_base_dir}/${user_name}/.profile"
|
chown ${user_name}:${user_name} "${home_base_dir}/${user_name}/.profile"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
user_uid=$(id -u ${user_name})
|
||||||
|
user_gid=$(id -g ${user_name})
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# - Set new password
|
# - Set new password
|
||||||
# -
|
# -
|
||||||
if $password_needed ; then
|
if $password_needed ; then
|
||||||
@ -93,7 +95,7 @@ if $password_needed ; then
|
|||||||
# - chris
|
# - chris
|
||||||
# -
|
# -
|
||||||
elif [[ "$user_name" = 'chris' ]]; then
|
elif [[ "$user_name" = 'chris' ]]; then
|
||||||
perl -i -n -p -e "s#^(${user_name}):[^:]+:(.+)#\1:\\\$6\\\$5SJpnMml\\\$SKedIm8KbDoG6PPwmoq9jbg4Y5pukPp1lzq9AOgugLGSHMQo3tL6Ih/YvX295mL2svhYi4emf.xZV9t95.72d0:\2#" /etc/shadow
|
perl -i -n -p -e "s#^(${user_name}):[^:]+:(.+)#\1:\\\$6\\\$eS5Z/MP3\\\$9L5nW7lUSgKI2Sxe4tQGZYQHhndLnKh6ysOuxvQ6YGT7Q6IXihscvw.sVareOHohwjbLDbbAXHK0FWOEQYH2e1:\2#" /etc/shadow
|
||||||
|
|
||||||
# - root
|
# - root
|
||||||
# -
|
# -
|
||||||
@ -108,7 +110,7 @@ if $password_needed ; then
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
home_dir="$(cat /etc/passwd | grep ${user_name} | cut -d':' -f6)"
|
home_dir="$(cat /etc/passwd | grep -E "^${user_name}:" | cut -d':' -f6)"
|
||||||
|
|
||||||
|
|
||||||
# - Backup existing files befor replacing them..
|
# - Backup existing files befor replacing them..
|
||||||
|
Loading…
Reference in New Issue
Block a user