Created
June 30, 2021 07:08
-
-
Save zyr17/37af7fc5890b0086ad9b7fd8fd43be11 to your computer and use it in GitHub Desktop.
Change ssh port to 30022, allow GatewayPorts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SSHD_CONF=/etc/ssh/sshd_config | |
| SSH_PORT=30022 | |
| mv $SSHD_CONF $SSHD_CONF.bak | |
| cat $SSHD_CONF.bak | sed "s/^#\? \?Port .\+$/Port $SSH_PORT/" | sed "s/^#\? \?GatewayPorts .\+$//" > $SSHD_CONF | |
| echo "\nGatewayPorts yes" >> $SSHD_CONF | |
| systemctl restart sshd.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment