##// END OF EJS Templates
Fixed: ssh public key and AllowUsers for ENABLE_USER=false
drtyhlpr -
r122:1e776801295f
parent child
Show More
@@ -42,6 +42,7 if [ "$ENABLE_SSHD" = true ] ; then
42 42 fi
43 43 fi
44 44
45 if [ "$ENABLE_USER" = true ] ; then
45 46 # Create $USER_NAME SSH config directory
46 47 mkdir -p "${R}/home/${USER_NAME}/.ssh"
47 48
@@ -67,13 +68,21 if [ "$ENABLE_SSHD" = true ] ; then
67 68 # Allow SSH public key authentication
68 69 sed -i "s|[#]*PubkeyAuthentication.*|PubkeyAuthentication yes|g" "${ETC_DIR}/ssh/sshd_config"
69 70 fi
71 fi
70 72
71 73 # Limit the users that are allowed to login via SSH
72 74 if [ "$SSH_LIMIT_USERS" = true ] ; then
75 allowed_users=""
73 76 if [ "$ENABLE_ROOT" = true ] && [ "$SSH_ENABLE_ROOT" = true ] ; then
74 echo "AllowUsers root ${USER_NAME}" >> "${ETC_DIR}/ssh/sshd_config"
75 else
76 echo "AllowUsers ${USER_NAME}" >> "${ETC_DIR}/ssh/sshd_config"
77 allowed_users="root"
78 fi
79
80 if [ "$ENABLE_USER" = true ] ; then
81 allowed_users="${allowed_users} ${USER_NAME}"
82 fi
83
84 if [ ! -z "$allowed_users" ] ; then
85 echo "AllowUsers ${allowed_users}" >> "${ETC_DIR}/ssh/sshd_config"
77 86 fi
78 87 fi
79 88
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant