fix(web-add): Fix deletion of ssh permissions

This commit is contained in:
Mathieu Trossevin 2024-10-21 17:14:58 +02:00
parent 1237c3c54b
commit ce8d082a25
Signed by: mtrossevin
GPG key ID: D1DBB7EA828374E9
2 changed files with 4 additions and 3 deletions

View file

@ -16,6 +16,8 @@ The **patch** part changes is incremented if multiple releases happen the same m
### Fixed
* Fix deletion of SSH permissions
### Removed
### Security

View file

@ -838,10 +838,9 @@ op_del() {
fi
if grep --quiet --extended-regexp --ignore-case '^AllowUsers' /etc/ssh/sshd_config; then
sed -i "s/^AllowUsers .*/& $in_login/" /etc/ssh/sshd_config
elif getent group "${SSH_GROUP}" 1>/dev/null 2>&1; then
usermod --append --groups "${SSH_GROUP}" "$in_login"
sed -i '/^AllowUsers/s/ '"${login}"'\( \|$\)/\1/' /etc/ssh/sshd_config
fi
/etc/init.d/ssh reload
if [ -d "$HOME_DIR/$login" ]; then
mv -i $HOME_DIR/"$login" $HOME_DIR/"$login"."$(date '+%Y%m%d-%H%M%S')".bak