所以我编写了一个可以更改 CentOS 上的 SSH 端口的脚本,但由于某种原因我遇到了此错误:
sshchangecOS6.sh:第 36 行:语法错误:意外的文件结尾
这是脚本:
#! /bin/bash
# This script changes the ssh port for logins on CentOS 5 and 6
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 2
read -r -p "Would you like to change the ssh port? [Y/N] " response
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]
then
read -p "What would you like to change the port to? (Chose between 1024-65535) " sshportconfig
if …Run Code Online (Sandbox Code Playgroud)