小编min*_*sec的帖子

在 CentOS 上使用 bash 脚本更改 SSH 端口

所以我编写了一个可以更改 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)

ssh bash port centos6

2
推荐指数
1
解决办法
3128
查看次数

标签 统计

bash ×1

centos6 ×1

port ×1

ssh ×1