@@ -42,6 +42,7 if [ "$ENABLE_SSHD" = true ] ; then | |||||
42 | fi |
|
42 | fi | |
43 | fi |
|
43 | fi | |
44 |
|
44 | |||
|
45 | if [ "$ENABLE_USER" = true ] ; then | |||
45 | # Create $USER_NAME SSH config directory |
|
46 | # Create $USER_NAME SSH config directory | |
46 | mkdir -p "${R}/home/${USER_NAME}/.ssh" |
|
47 | mkdir -p "${R}/home/${USER_NAME}/.ssh" | |
47 |
|
48 | |||
@@ -67,13 +68,21 if [ "$ENABLE_SSHD" = true ] ; then | |||||
67 | # Allow SSH public key authentication |
|
68 | # Allow SSH public key authentication | |
68 | sed -i "s|[#]*PubkeyAuthentication.*|PubkeyAuthentication yes|g" "${ETC_DIR}/ssh/sshd_config" |
|
69 | sed -i "s|[#]*PubkeyAuthentication.*|PubkeyAuthentication yes|g" "${ETC_DIR}/ssh/sshd_config" | |
69 | fi |
|
70 | fi | |
|
71 | fi | |||
70 |
|
72 | |||
71 | # Limit the users that are allowed to login via SSH |
|
73 | # Limit the users that are allowed to login via SSH | |
72 | if [ "$SSH_LIMIT_USERS" = true ] ; then |
|
74 | if [ "$SSH_LIMIT_USERS" = true ] ; then | |
|
75 | allowed_users="" | |||
73 | if [ "$ENABLE_ROOT" = true ] && [ "$SSH_ENABLE_ROOT" = true ] ; then |
|
76 | if [ "$ENABLE_ROOT" = true ] && [ "$SSH_ENABLE_ROOT" = true ] ; then | |
74 | echo "AllowUsers root ${USER_NAME}" >> "${ETC_DIR}/ssh/sshd_config" |
|
77 | allowed_users="root" | |
75 | else |
|
78 | fi | |
76 | echo "AllowUsers ${USER_NAME}" >> "${ETC_DIR}/ssh/sshd_config" |
|
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 | fi |
|
86 | fi | |
78 | fi |
|
87 | fi | |
79 |
|
88 |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant