$ ssh-keygen -t rsa -C caiwang213@qq.comphp
一路回車,直到生成 id_rsa, id_rsa.publinux
rpm文件下載git
http://rpm.pbone.net/index.php3?stat=3&search=connect-proxy&srodzaj=3vim
$ sudo rpm -ivh connect-proxy-1.93-2.el6.i686.rpmsession
$ vim ~/.ssh/config (沒有則新建文件),添加ssh
Host git.oschina.net *.oschina.netide
ProxyCommand connect-proxy -H 192.168.60.34:18608 %h %p 或ui
#ProxyCommand /usr/bin/nc -X connect -x 192.168.60.34:18608 %h %pspa
IdentityFile ~/.ssh/id_rsa.net
User caiwang213@qq.com
說明:ProxyCommand能夠用linux自帶/usr/bin/nc命令,參考man 5 ssh_config
ProxyCommand /usr/bin/nc -X connect -x 192.168.60.34:18608 %h %p # Redhat7.3不可行
$ chmod 600 /home/caiwang213/.ssh/config,否則會提示:
[caiwang213@caiwang213 ~]$ ssh -v -T git@git.oschina.net
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
Bad owner or permissions on /home/caiwang213/.ssh/config
$ ssh -v -T git@git.oschina.net 提示:
[caiwang213@caiwang213 ~]$ ssh -v -T git@git.oschina.net
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /home/caiwang213/.ssh/config
debug1: Applying options for git.oschina.net
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Executing proxy command: exec connect-proxy -H 192.168.60.34:18608 git.oschina.net 22
debug1: permanently_drop_suid: 500
debug1: identity file /home/caiwang213/.ssh/id_rsa type 1
debug1: identity file /home/caiwang213/.ssh/id_rsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.2
debug1: match: OpenSSH_6.2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'git.oschina.net' is known and matches the RSA host key.
debug1: Found key in /home/caiwang213/.ssh/known_hosts:4
debug1: ssh_rsa_verify: signature correct
bug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering public key: /home/caiwang213/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Welcome to Git@OSC, caiwang213!
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2440, received 3584 bytes, in 0.5 seconds
Bytes per second: sent 4894.0, received 7188.6
debug1: Exit status 0