Suggestion for the function:

if [ -e /etc/ssh/sshd_config ] ; then
    if [ ! -e /etc/systemd/system/ssh.socket ] ; then
        listenport=$(grep Port /etc/ssh/sshd_config | cut -d ' ' -f 2)
        systemdsocketfile=$(sed
"s/ListenStream=22/ListenStream=$listenport/"
/lib/systemd/system/ssh.socket)
        echo "$systemdsocketfile" > /etc/systemd/system/ssh.socket
    fi
fi

Attachment: set_port_in_ssh_socket.sh
Description: application/shellscript



Reply via email to