Thursday, May 20, 2010

ssh套件&相關小筆記

給未來的裕翔

想要使用ssh時

請安裝openssh, openssh-clients, openssh-server

ssh server會以tcp的port 22來等待服務, ssh client則不是以port 22連過去

client端的~/.ssh/known_hosts會紀錄連過線的ssh server

要設定ssh server時

記住是/etc/ssh/sshd_config

而不是/etc/ssh/ssh_config

裡面有幾個設定可以注意一下

PermitRootLogin建議設為no

PermitRootLogin without-password, 這是讓開放root以passphrase登入

Banner /file/path, 可以在/file/path裡面加入文字, 秀給ssh client登入時看

sftp老師很喜歡

因為它有lls

get file [local-path]

put local-path [remote-path]

另外, 以下兩個指令通常很少用, -L是local, -R是remote

ssh -L client-port:hosta:hosta-port hostb

我聽本機的client-port, 然後直接丟給hostb, 請hostb幫我丟給hosta的hosta-port

ssh -R serverport:hosta:hosta-port hostb

我聽遠端的server-port, 有服務請求到它那的話, 我幫它丟給hosta的hosta-port

No comments:

Post a Comment