SSH 實用指令
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
讓 A, B 兩台遠端主機互相傳送檔案
將兩台主機的私鑰都加入本機 SSH agent:
ssh-add ~/downloads/geth-node-1.pem
ssh-add ~/downloads/geth-node-2.pem
SSH 進入第一台 EC2 instance with agent forwarding:
ssh -A -i "~/downloads/geth-node-1.pem" ubuntu@ec2-....ap-southeast-1.compute.amazonaws.com
From the first instance, attempt to SCP the file using agent forwarding to authenticate on the second instance:
scp ~/target/file ubuntu@ec2-....ap-southeast-1.compute:/path/to/destination/
讓本地端可以透過 EC2 連線到 AWS RDS (EC2 要先與 RDS 設定好 security group 可互相連線)
ssh -i "~/ec2-ssh-key.pem" -N -L localhost:5432:RDS..southeast-1.rds.amazonaws.com:5432 ubuntu@ec2ip.ap-southeast-1.compute.amazonaws.com
ssh-add -K ~/.ssh/...keyname
ssh-add -l
delete all the private keys stored in the SSH agent
ssh-add -D
開啟:vim ~/.ssh/config
Host bitbucket.org
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/key1
IdentityFile ~/.ssh/key2
IdentityFile ~/.ssh/key3