Infosec 101 – SSH Tutorial

June 23, 2016 | Views: 7263

Begin Learning Cyber Security for FREE Now!

FREE REGISTRATIONAlready a Member Login Here

The Infosec 101 series is geared towards relatively new members of the information security domain and will include some basic, yet important, concepts. This is the first post in the series.

 

SSH stands for secured shell. It works on TCP port 22 and is used for remote administration. It’s an asymmetric cryptographic protocol and, hence, makes use of a public and private key. SSH was a replacement for TELNET (TCP PORT 23) which didn’t employ data encryption.

We’ll use Openssh for our practical, with both machines on the local network. The server machine will be running Ubuntu, while the client will be a machine running Kali Linux.

 

Setting Up the Server

On Ubuntu:

Sudo apt-get install openssh-server

Ssh-keygen –t rsa

Command 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.pub

You’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 Side

On the client side, we need to generate keys in the same way as we did on server.

Ssh-keygen –t rsa

Again, the public and private keys will be created and stored in the .ssh folder.

 

Key Exchange

To 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@IP

The 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 Connection

To connect to the server:

Ssh username@IP

Enter yes as input to warning message and you’ll have the terminal of the server to play with the files.

 

Thanks and good luck!

Share with Friends
FacebookTwitterLinkedInEmail
Use Cybytes and
Tip the Author!
Join
Share with Friends
FacebookTwitterLinkedInEmail
Ready to share your knowledge and expertise?
9 Comments
  1. It’s pretty well understood in your simplified method

Page 2 of 2«12
Comment on This

You must be logged in to post a comment.

Our Revolution

We believe Cyber Security training should be free, for everyone, FOREVER. Everyone, everywhere, deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is a free community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Support Cybrary

Donate Here to Get This Month's Donor Badge

 

We recommend always using caution when following any link

Are you sure you want to continue?

Continue
Cancel