ssh remote link without server_code

Steps

  1. 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’
  2. 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
      3
      Host server_name
      Hostname server_ip
      IdentityFile ~/.ssh/server_key
  3. Test

    • in client bash, run
      1
      ssh my_account@server_name