diff --git a/set_suexec_users_nologin.sh b/set_suexec_users_nologin.sh index 8234a7a..6c510b2 100755 --- a/set_suexec_users_nologin.sh +++ b/set_suexec_users_nologin.sh @@ -254,7 +254,12 @@ done < <( | awk '{print $2}' | sort -u ) -[[ ${#suexec_user_arr[@]} -gt 0 ]] || fatal "No suexec users found in '${_vhost_base_dir}'." +# - No suexec users at all is not an error - just nothing to do +# - +if [[ ${#suexec_user_arr[@]} -eq 0 ]] ; then + info "No suexec users found in '${_vhost_base_dir}' - nothing to do." + clean_up 0 +fi echo "" @@ -320,6 +325,15 @@ for _user in "${suexec_user_arr[@]}" ; do continue fi + # - Don't touch users with ssh keys - they would lose their (ssh/sftp) access + # - + _home_dir="$(echo "$_passwd_entry" | cut -d: -f6)" + if [[ -s "${_home_dir}/.ssh/authorized_keys" ]] ; then + echo_skipped + echo -e " \033[33mUser has '${_home_dir}/.ssh/authorized_keys' (ssh access in use?)\033[m" + continue + fi + if $dry_run ; then echo_skipped echo -e " \033[33mDry-run:\033[m would change shell $_shell --> $new_shell"