Files
StateGrid/install_shell/create_users.sh
Qin Bo 39d88f389f modified: install_shell/audit_patch.sh
deleted:    install_shell/cgroup-d5000-install/42-2014-01-15-062120/README
	deleted:    install_shell/cgroup-d5000-install/42-2014-01-15-062120/install.sh
	modified:   install_shell/cgroup-d5000-install/install.sh
	modified:   install_shell/create_users.sh
	modified:   install_shell/ntpd_cron_patch.sh
	modified:   install_shell/other.sh
	modified:   install_shell/set_network.sh
	modified:   install_shell/set_ssh.sh
	modified:   setup.sh

Signed-off-by: Qin Bo <bqin@linx-info.com>
2014-02-19 11:12:45 +08:00

47 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
. ./check_function.sh
#$1:user name,$2:home directory,$3:shell type
#examples :
#d5000 /home/d5000/guodiao tcsh
#kingsoft /home/kingsoft/guodiao bash
#ems /users/ems tcsh
USER_SHELL=$3
USER_HOME=$2
USER_NAME=$1
# check $USER_NAME group
GRP_CONFIG=/etc/group
check_config $GRP_CONFIG ^${USER_NAME}
if [ $rtn -eq 2 ]; then
groupadd ${USER_NAME}
elif [ $rtn -eq 0 ]; then
echo "${USER_NAME} group exist..."
fi
# check ${USER_NAME}
USER_CONFIG=/etc/passwd
check_config $USER_CONFIG ${USER_NAME}
if [ $rtn -eq 2 ]; then
mkdir -p ${USER_HOME}
useradd -m -d ${USER_HOME} -s /bin/${USER_SHELL} ${USER_NAME}
usermod -p `openssl passwd ${USER_NAME}` -g ${USER_NAME} -G audio,tty ${USER_NAME}
elif [ $rtn -eq 0 ]; then
usermod -g ${USER_NAME} -G audio,tty ${USER_NAME}
echo "${USER_NAME} user exist..."
fi
# check ${USER_NAME} home
check_konsole $USER_HOME
check_konsole $HOME
cp -r root-kde/.kde $HOME/
cp -r d5000-kde/.kde $USER_HOME/
#cp -r /etc/skel/.kde $USER_HOME/
cp -r d5000-fcitx/.config $USER_HOME/
chown -R ${USER_NAME}:${USER_NAME} ${USER_HOME}
usermod -p `openssl passwd root` root