首先澄清一下觀念,ssh是由inetd所管理的,不是歸xinetd管的喔!(因為它跟xinetd一樣放在/etc/init.d/裡面)


第一步,安裝openssh:
$ apt-get install openssh


開始設定/etc/ssh/sshd_config,確認:
# port其實可以改一下
port 2698

# protocol只使用第二版,因為它加上了連線檢測的機制, 可以避免連線期間被插入惡意的攻擊碼。
Protocol 2

# root不能使用ssh!!!
PermitRootLogin no


到/etc/services更改port:
# 註解掉原ssh的tcp與udp兩行設定,
# 到最下面一行(Local services後)補上下面的設定
ssh     tcp     2698
ssh     udp     2698


接著到/etc/hosts.allow與/etc/hosts.deny新增連線許可:
# Linux的判斷順序會先從allow檔再判定deny檔
$ sudo vim /etc/hosts.allow
ALL: ALL
sshd: 127.0.0.1 192.168.1.0/24

$ sudo vim /etc/hosts.deny
ALL: ALL


重新啟動ssh daemon:
/etc/init.d/ssh restart


參考資料:

Ubuntu作業系統教學─如何設定SSH遠端連線功能:

   http://ipzoner.pixnet.net/blog/post/23520297

鳥哥的 Linux 私房菜:

   http://linux.vbird.org/linux_server/0310telnetssh.php#ssh


延伸閱讀:

鳥哥的 Linux 私房菜:sftp, scp

   http://linux.vbird.org/linux_server/0310telnetssh.php#sftp

鳥哥的 Linux 私房菜:以 rsync 進行同步鏡相備份

   http://linux.vbird.org/linux_server/0310telnetssh.php#rsync


創作者介紹
創作者 When you pray, move your feet. 的頭像
justicer

When you pray, move your feet.

justicer 發表在 痞客邦 留言(0) 人氣( 219 )