From 7f42054a141bcf0f85a075a7dfa036e576e32c38 Mon Sep 17 00:00:00 2001 From: midoks Date: Sat, 5 Aug 2023 12:29:39 +0800 Subject: [PATCH] Update ubuntu.sh --- scripts/install/ubuntu.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/install/ubuntu.sh b/scripts/install/ubuntu.sh index ba774f0fd..a5a9953c7 100644 --- a/scripts/install/ubuntu.sh +++ b/scripts/install/ubuntu.sh @@ -24,7 +24,8 @@ apt install -y locate locale-gen en_US.UTF-8 localedef -v -c -i en_US -f UTF-8 en_US.UTF-8 -SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'` +SSH_PORT_LINE=`cat /etc/ssh/sshd_config |grep Port | grep 22| tail -1` +SSH_PORT=${SSH_PORT_LINE/"Port "/""} echo "SSH PORT:${SSH_PORT}" if [ -f /usr/sbin/ufw ];then