User Tools

Site Tools



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 [email protected] -p 2222

ssh auto login

ssh key generate

Apps-iMac:.ssh pengjianqing$ ssh-keygen -t rsa -C "[email protected]"

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
The key fingerprint is:
ec:aa:66:48:07:e0:91:53:73:2b:e9:14:c0:f6:ca:d5 [email protected]
The key's randomart image is:
+--[ RSA 2048]----+
|..++ .           |
|.*  = .          |
|o.++..           |
| .+o.E .         |
|. oo    S        |
| o. .  .         |
| . o    .        |
|  . o  .         |
|   o...          |

Then get the pub key


Add it to the server side

[email protected]:~# 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

    IdentityFile ~/.ssh/digitalocean_rsa
    User root

so finally the config will be like this

    IdentityFile ~/.ssh/digitalocean_rsa
    User root

    IdentityFile ~/.ssh/aliyun_rsa
    User root

    IdentityFile ~/.ssh/yardvps_rsa
    User root

/var/www/dokuwiki/wiki/data/pages/linux/ssh.txt · Last modified: 2017/12/15 13:22 by percy