- Start your virtual machine and login
- Get the IP address by typing ifconfig
- Poweroff your machine
- Go to settings >> Network >> Advance >> Port Forwarding
- Add new port forwarding rule
- Host IP : 127.0.0.1
- Host Port: 2222
- Guest IP: [IP of your virtual machine]
- Guest Port: 22
Learn Linux in a very basic way
Lorem ipsum dolor sit amet, conscur adisng elit, sed do eiusmod tempor iniunt ut labore et dolore mana aliqua. Ut enim ad minim veniam, quis nostrud exetation ullco laboris nisi ut aliquip ex ea commodo coequat. Duis aute irure dolor
Setup your own server
Lorem ipsum dolor sit amet, conscur adisng elit, sed do eiusmod tempor iniunt ut labore et dolore mana aliqua. Ut enim ad minim veniam, quis nostrud exetation ullco laboris nisi ut aliquip ex ea commodo coequat. Duis aute irure dolor
Build your own website
Lorem ipsum dolor sit amet, conscur adisng elit, sed do eiusmod tempor iniunt ut labore et dolore mana aliqua. Ut enim ad minim veniam, quis nostrud exetation ullco laboris nisi ut aliquip ex ea commodo coequat. Duis aute irure dolor
Learn Linux in a very basic way
Lorem ipsum dolor sit amet, conscur adisng elit, sed do eiusmod tempor iniunt ut labore et dolore mana aliqua. Ut enim ad minim veniam, quis nostrud exetation ullco laboris nisi ut aliquip ex ea commodo coequat. Duis aute irure dolor
Please watch this tutorial video
What you need:
Putty
Putty Key Generator
Peagent
Generate SSH key
1. Run Putty Key Generator and click Generate2. Move your mouse randomly over the blank area till the progress bar finish.
3. [Optional] Once key is generated, under the key comment textbox, add any word you like. Its recommended for you to remember what this key is about.
4. Protect your SSH key by adding a password or any word you’d like under Key passphrase and confirm passphrase. This will serve as your password to the SSH key so please remember it.
5. Click Save Public and Private key to your local drive.
6. For the benefit of many, lets close the Key Generator.
You can still reopen the generated key by loading the private key.
1. Open Putty Key Generator and click Load button
2. Locate the private key file from the folder you saved it. It will require you to enter your passphrase
3. Under Public key for pasting… you’ll see characters starting from ‘ssh-rsa’. This is the key that we will copy later.
Applying SSH key to your Rasberry Pi
Set your Putty to connect to Raspberry Pi
1. On Host name, enter your Raspberry Pi hostname. Default is raspberrypi.local
2. On Saved Sessions, enter any name you want for this session
3. Click Save and Open and login again. We’re not done yet.
Add the public key to the pi user
On the putty consoleEnsure that you are in the user home directory
cd
Create .ssh Directory and restrict permission
mkdir .ssh chmod 700 .ssh
Create authorized_keys file and edit
nano .ssh/authorized_keys
Back to Putty Key Generator. Under Public key for pasting… you’ll see characters starting from ‘ssh-rsa’. Copy this key. Right click in the middle of it and click select all then right click again and click copy
On Putty console, paste the key. Right click in the middle of the console and the key will be pasted. Be careful not to type any thing as it will not work.
Save it by pressing ctrl+o and ctrl+x to exit
Restrict the permissions of the authorized_keys file
chmod 600 .ssh/authorized_keys
Close Putty console.
Using Pageant
Run Peagent. On your systemtray, you can see Peagent. Click it, add Key and locate the folder where you save your Private SSH key. Enter your Key passphraseLast configuration for Putty
1. On Putty, left side under Category list, click Data. Enter the Username (pi) on Auto-login username2. Click Session under the Category and Click Save Button
3. Click Open. It should login automatically.
Please remember that auto-login will only work if Peagent is running and private key is added to it.
Reference
Prerequisite software:
Generate SSH key
- Run Putty Key Generator
- Click Generate
- Move your mouse randomly over the blank area till the progress bar finish.
- [Optional] Once key is generated, under the key comment textbox, add any word you like. Its recommended for you to remember what this key is about.
- Protect your SSH key by adding a password or any word you’d like under Key passphrase and confirm passphrase. This will serve as your password to the SSH key so please remember it.
- Click Save Public Key to the folder you like and name it as MySSHkey.ppk Keep this file.
Setup the Auto Login with SSH key using Putty
- Run Peagent
- On your systemtray, you can see Peagent. Right click and add Key and locate the folder where you save your SSH key (MySSHkey.ppk) and open it.
- Enter your Key passphrase
Set your Putty to connect to your server
- On Host name, enter your server’s ip address or the domain name.
- On Saved Sessions, enter any name you want for this session
- On the left side under Category list, click Data. Enter the Username (demo) on Auto-login username
- Click Session under the Category and Click Save Button
- Click Open. Enter the password. We’re not done yet.
Add the public key to the remote user
On the putty console and User(demo) is logged1. Ensure that you have access to the user directory
2. Ensure you are in /home/demo directorysudo chown -R demo /home/demo It may ask you to enter root password
3. Create .ssh Directory and restrict permissioncd
4. Create authorized_keys file and editmkdir .ssh chmod 700 .ssh
5. Now switch to Putty Key Generator. Get your public key you created from Putty Key Generator. If you closed it don’t worry, follow this step:nano .ssh/authorized_keys
6. Back to the Putty console again and paste the key. Right click in the middle of the console and the key will be pasted. Be careful not to type any thing as it will not work.
- Open Putty Key Generator
- Click Load button
- Locate your key MySSHkey.ppk from the folder you saved it
- It will require you to enter your passphrase
- Under Public key for pasting… you’ll see characters starting from ‘ssh-rsa’. You have to copy all of this. To do that, right click in the middle of it and click select all then right click again and click copy
7. Save it by pressing ctrl+o and ctrl+x to exit
8. Restrict the permissions of the authorized_keys file
9. Open a new session on your Putty and open your server. It should login automatically.chmod 600 .ssh/authorized_keys
* Please remember that auto-login will only work if Peagent is running and your key is added to it.





