Tôi có một vấn đề có thể tái tạo trên máy ảo Linux Ubuntu (14.04 LTS) được tạo trong Azure.
Sau khi cài đặt systemdgói thông qua tập lệnh, hệ thống từ chối các kết nối ssh mới, vô hạn.
Hệ thống đang khởi động lên.
Kết nối được đóng bởi xxx.xxx.xxx.xxx
Kết nối ssh hoạt động được duy trì mặc dù. Không có /etc/nologintập tin hiện diện trong hệ thống.
Tùy chọn duy nhất tôi thấy là thiết lập lại cứng giúp giải quyết vấn đề. Nhưng làm thế nào để tôi tránh nó?
Đây là kịch bản tôi đang sử dụng:
#!/bin/bash
# Script input arguments
user=$1
server=$2
# Tell the shell to quote your variables to be eval-safe!
printf -v user_q '%q' "$user"
printf -v server_q '%q' "$server"
#
SECONDS=0
address="$user_q"@"$server_q"
function run {
    ssh "$address" /bin/bash "$@"
}
run << SSHCONNECTION
    # Enable autostartup
        # systemd is required for the autostartup
        sudo dpkg-query -W -f='${Status}' systemd 2>/dev/null | grep -c "ok installed" > /home/$user_q/systemd-check.txt
        systemdInstalled=\$(cat /home/$user_q/systemd-check.txt)
        if [[ \$systemdInstalled -eq 0 ]]; then
            echo "Systemd is not currently installed. Installing..."
            # install systemd
            sudo apt-get update
            sudo apt-get -y install systemd
        else
            echo "systemd is already installed. Skipping this step."
        fi
SSHCONNECTION