Cara mengganti port SSH linux centOS

Bagaimana cara mengganti port SSH pada linux centOS?

Jika kita sudah memiliki VPS ataupun Dedicated Server, tentunya kita akan punya akses SSH. Default port SSH adalah 22, port ini adalah port yang umum digunakan. Agar port ini tidak dimasukkin oleh orang-orang usil atau bot, hendaknya port ini diganti menjadi selain 22, bisa diganti menjadi berapa saja. Misalnya jadi 122, 1876, 2723, dan lain-lain silakan bebas terserah anda saja, selama tidak bentrok dengan port-port utama lainnya yang sudah digunakan.

Cara mengganti port SSH sebagai berikut :

1. Login ke SSH dengan menggunakan putty

2. Ketikkan perintah : nano /etc/ssh/sshd_config

 #       $OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options change a
# default value.

#Port 22
#Protocol 2,1
Protocol 2
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

3. Dari contoh di atas, Anda cukup perhatikan yang saya beri warna merah. Anda cukup ganti “#Port 22” dengan “Port 505” jika Anda ingin mengubahnya menjadi port 505. Seperti contoh di bawah ini :

 #       $OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options change a
# default value.

Port 505
#Protocol 2,1
Protocol 2
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

 

Kemudian tekan tombol CTRL + X untuk menyimpan.

4. Lalu restart SSH dengan perintah : /etc/init.d/sshd restart

5. Tutup Putty Anda, lalu cobalah login lagi ke SSH dengan port 505.

Demikian selesai sudah kita mengganti port default SSH menjadi custom port SSH yang kita inginkan pada VPS atau Dedicated Server sendiri. Selamat Mencoba pada akun VPS anda!