Mengganti Port SSH pada Ubuntu Linux

Tags: April 28, 2012 10:50 AM

Nomor port yang dapat digunakan pada linux adalah 1-65535. Dalam contoh digunakan port 22222.

# vim /etc/ssh/sshd_config

[-- SNIP --]
# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 22222
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
[-- SNIP --]

## Reload kembali service ssh
# service ssh reload

## lihat daftar process yang listen pada port tertentu
# netstat -ntap
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1994/nginx.conf 
tcp        0      0 0.0.0.0:22222           0.0.0.0:*               LISTEN      2026/sshd       
tcp        0    240 106.187.94.18:22        114.79.61.39:38656      ESTABLISHED 2035/0          
tcp6       0      0 :::22222                :::*                    LISTEN      2026/sshd
Jangan lupa untuk mengubah konfigurasi iptables jika port ssh baru tersebut diblok.

Share on Facebook Twitter

0 comments:

Post a Comment