There are several ways we can do that.
Local machine:generate keys
- username and password : ssh username@host_ip port ; then input password
- 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
- make sure .ssh is existed. use "ls -al "to examine.
- if .ssh not exist, then "mkdir ~/.ssh"
- then copy id_rsa.pub to .ssh/
No comments:
Post a Comment