우분투 firefox에서 SSH protocol 링크

여러대의 서버를 관리하면서, 모니터링할수 있는 페이지를 만들고, 해당 서버를 클릭하면 SSH로 바로 연결할수 있도록 MIME 링크를 만들어서 사용하고 있습니다. MIME 링크 처리는 윈도우즈에서 프로그램을 제작해서 ssh:// 형태의 MIME type에 대해서 처리하게 했습니다. 프로그램은 단순히 putty를 찾아서 실행해주는 간단한 구조입니다.

이걸 리눅스에서 할려고 했더니 어떻게 해야하는지 좀 헤맸습니다. mime type이라는 건 서버에서 파일이 내려갈때 HTTP header에 붙어서 가고, 이를 브라우저에서 처리하는 거라… ssh:// 형태의 링크는 mime 링크로는 처리가 안되고, 이를 처리하는 걸 protocol handler라고 하더군요. 검색어 자체가 잘못되서 해결책을 찾는데 꽤 시간이 걸렸습니다.

먼저 gnome에서 ssh 프로토콜을 프로그램 연결하는 부분입니다.

$ gconftool-2 -s /desktop/gnome/url-handlers/ssh/command ‘/usr/bin/gnome-terminal -e “~/bin/handle_protocol.sh %s”‘ –type string
$ gconftool-2 -s /desktop/gnome/url-handlers/ssh/enabled -t boolean true

참고 URL: http://kb.mozillazine.org/Register_protocol

~/bin/handle_protocol.sh 파일 내용입니다.

#!/bin/sh

link=$1
proto=`echo "$link"|cut -d: -f1`
host=`echo "$link"|cut -d/ -f3`
echo "$proto $host"
exec $proto $host


파일 만들고 실행되도록 chmod 해야 합니다.

$ chmod a+x ~/bin/handle_protocol.sh

이렇게 하면 firefox에서 ssh:// 로 시작하는 링크 누르면 gnome-terminal이 뜨면서 ssh로 연결됩니다. telnet도 똑같은 방법으로 등록하면 사용이 가능합니다.

이렇게 설정했는데 우분투(9.10)에서 원격 접속했을때 윈도우즈에서 putty 이용했을때보다 속도가 많이 느리더군요. /etc/ssh/ssh_config에서 맨 아래 두줄을 주석 처리하면 빨라집니다.

#GSSAPIAuthentication yes
#GSSAPIDelegateCredentials no

출처: http://onlyubuntu.blogspot.com/2007/04/fix-for-ssh-slow-to-ask-for-password-in.html

Leave a Reply

Your email address will not be published.