Wednesday, November 11, 2015

local linux log in remote linux server (key pairs)

There are several ways we can do that.


Local machine:generate keys

  1. username and password : ssh username@host_ip port ; then input password 
  2. key pairs (more secure then password logging in): it's a two way method, you need to create both private key(for local ubuntu to authenticate) and public key (to transfer to the remote server)
    • create a new folder : mkdir ~/.ssh
    • ssh-keygen -t rsa ; then we will find two files : id_rsa and id_rsa.pub in .ssh/
    • then transfer the public key to remote server : here is a simple command  (ssh-copy-id <username@host>) 

Remote server:upload public key

  1. make sure .ssh is existed. use "ls -al "to examine. 
  2. if .ssh not exist, then "mkdir ~/.ssh"
  3. then copy id_rsa.pub to .ssh/

No comments:

Post a Comment