ssh remote link without server_code
ssh remote link without server_code
Steps
Generate ssh key, and add it to authorized_keys (public key)
- in server, run ‘ssh-keygen’
- in client, run ‘cat id_rsa.pub >> authorized_keys’
Add ssh key to client
- in local server, run below command
1
2
3
4
5
6$ cd .ssh
$ scp my_account@server_ip:~/.ssh/id_rsa .
$ mv id_rsa server_key
$ echo "Host server_name" >> config # server_name is the name for your server
$ echo "Hostname server_ip" >> config #server_ip is the ip of your server
$ echo "IdentityFile ~/.ssh/server_key" >> config - final config file like this
1
2
3Host server_name
Hostname server_ip
IdentityFile ~/.ssh/server_key
- in local server, run below command
Test
- in client bash, run
1
ssh my_account@server_name
- in client bash, run
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Wizard!