Cara Mengganti SSH Port di Linux

By default the SSH port for remote to linux servers is 22. But for security reasons, Exabytes Indonesia changed the SSH port to 8288. But if you want to change the port to another port, then you can change it in the following way:


1. Login to the Server via SSH as usual


For Windows users, you can use putty. Then select the putty.exe

2. Then open the following file

# nano /etc/ssh/sshd_config

If the nano editor is not installed, then you need to install it first.


For CentOS


yum install nano -y


For debian/Ubuntu


apt install nano -y


3. Search the parameter "Listen 8288" to "Listen 6969"


In this study case, we will change port 8288 to port 6969.
4. Save the file and restart the sshd service.

# /etc/init.d/openssh-server restart (Debian dan Ubuntu)

or (Ubuntu)

# /etc/init.d/ssh restart

or (CentOS)

# service sshd restart (Centos dan Redhat)


5. After that, allow Port 6969 in the firewall

(Debian)
# iptables -I INPUT 1 -p tcp --dport 6969 -j ACCEPT
# iptables-save


(Ubuntu)
# ufw allow 6969/tcp


(Centos)
# firewall-cmd --permanent --zone=public --add-port=6969/tcp
# firewall-cmd --reload


6. Before the session is closed, open a new session and try to do remote ssh using the new port.


If you successfully login SSH using the new port, you can close the existing session.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.