Infosec 101 - SSH Tutorial
Sudo apt-get install openssh-server
Ssh-keygen –t rsaCommand 1 installs the openssh server on Ubuntu machine.Command 2 generates the public and private keys.Once the keys are generated, they're stored in the home/username/.ssh directory. The private keys and public keys file have the name - id_rsa and id_rsa.pubYou'll be asked to put a password for this folder. It's suggested you choose a strong one and then create a file with the name authorized_keys. This file will have the public keys of the client, which connect to the server. On the Client SideOn the client side, we need to generate keys in the same way as we did on server.
Ssh-keygen –t rsaAgain, the public and private keys will be created and stored in the .ssh folder. Key ExchangeTo connect client to the server, the public key of the client needs to be copied in the ‘authorized_keys’ file inside the .ssh folder.To copy the public key of the client, we'll the following command:Ssh-copy-id username@IPThe ssh-copy-id command is present in the openssh package. It automatically copies the public key from the .ssh directory on the client machine to the authorized_keys files in the .ssh directory on the server. The ConnectionTo connect to the server:Ssh username@IPEnter yes as input to warning message and you'll have the terminal of the server to play with the files. Thanks and good luck!