User Tools

Site Tools


linux:ssh

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
linux:ssh [2013/09/06 16:12] – created percylinux:ssh [2017/12/15 13:22] (current) – [multiple ssh keys] percy
Line 2: Line 2:
  
 http://www.aixchina.net/home/space.php?uid=73104&do=blog&id=30463 http://www.aixchina.net/home/space.php?uid=73104&do=blog&id=30463
 +
 +http://shenfeng.me/ssh-usage.html
 +
 +Forward the local port 8080 to the remote server 8080,so you can visit the local server via the remote server.
 +  ssh -R :8080:localhost:8080 -Nf root@vps.pjq.me -p 2222
 +  
 +  
 +  
 +====== ssh auto login ======
 +  
 +  http://riny.net/2014/git-ssh-key/
 +  
 +===== ssh key generate =====
 +  Apps-iMac:.ssh pengjianqing$ ssh-keygen -t rsa -C "pengjianqing@gmail.com"
 +<code>
 +Generating public/private rsa key pair.
 +Enter file in which to save the key (/Users/pengjianqing/.ssh/id_rsa): digitalocean_rsa
 +Enter passphrase (empty for no passphrase):
 +Enter same passphrase again:
 +Your identification has been saved in digitalocean_rsa.
 +Your public key has been saved in digitalocean_rsa.pub.
 +The key fingerprint is:
 +ec:aa:66:48:07:e0:91:53:73:2b:e9:14:c0:f6:ca:d5 pengjianqing@gmail.com
 +The key's randomart image is:
 ++--[ RSA 2048]----+
 +|..++ .           |
 +|.*  = .          |
 +|o.++..           |
 +| .+o.E .         |
 +|. oo    S        |
 +| o. .  .         |
 +| . o    .        |
 +|  . o  .         |
 +|   o...          |
 ++-----------------+
 +</code>
 +
 +Then get the pub key
 +  cat digitalocean_rsa.pub
 +
 +Add it to the server side
 +  root@pjq:~# vim ~/.ssh/authorized_keys
 +  
 +====== multiple ssh keys ======
 +Sometimes we will have many different ssh keys, so need config it to support different keys.
 +  
 +  touch ~/.ssh/config
 +Apps-iMac:.ssh pengjianqing$ cat config
 +<code>
 +Host ef.pjq.me
 +    IdentityFile ~/.ssh/digitalocean_rsa
 +    User root
 +</code>
 +
 +so finally the config will be like this
 +<code>
 +Host ef.pjq.me
 +    IdentityFile ~/.ssh/digitalocean_rsa
 +    User root
 +
 +Host aliyun.pjq.me
 +    IdentityFile ~/.ssh/aliyun_rsa
 +    User root
 +
 +Host vps.pjq.me
 +    IdentityFile ~/.ssh/yardvps_rsa
 +    User root
 +</code>
 +
 +  - Refer https://serverfault.com/questions/295768/how-do-i-connect-to-ssh-with-a-different-public-key
 +====== ssh socks 5 ======
 +  ssh -qTfnN -D 7070 root@vps.pjq.me -p 2222
/var/www/dokuwiki/wiki/data/attic/linux/ssh.1378455173.txt.gz · Last modified: 2016/05/05 13:06 (external edit)