loading


In this Tutorial you get to learn how to generate ssh keys using puTTYgen and how to launch puTTY using Windows batch. Tested on Raspberry Pi 2 and Windows 7.

Step 1: Downloads

Step 2: Pre Key Setup on Server

Login to your Pi using Putty.
Navigate into your account home directory.
Run
mkdir -p .ssh; touch .ssh/authorized_keys

Step 3: Generate a New Key

Run puTTYgen to generating a new key.
You need to select which type of key you want to generate, and also select the strength of the key.
Then press the Generate button, to actually generate the key.
Once you have generated the key, select a comment field and a passphrase. if you want to type a passphrase every time( I don't)
Now you’re ready to save the private key to disk; press the Save private key button. (it should end in ppk)
Under Key you should see a lot of random text.
Right click and "select all" and "Copy" it into your buffer.

Step 4: Adding Key to Your Server

Login to your server.
Navigate into your account home directory.
Once there, we are going to echo the key into your authorized_keys file.
Run
echo "YOUR VERY VERY LONG KEY THAT WAS IN YOUR BUFFER" >> .ssh/authorized_keys

Your key pair is now ready for use.
Logout of your server

Step 5: Optional Setup a One Click Batch File to Login

Open the WinPuttyHelper.rar file.
copy post_login_cmds.txt & setup.bat
Run
setup.bat

After setup is completed you can remove "-m post_login_cmds.txt" from the bat file it generates and it will auto login without logging out of your server.

Why is using SSH key more secure than using passwords?SSH keys are long and complex, far more than any password could be. But they don't expire, and they sit on a disk where they can be stolen from. On the other hand, they don't get transmitted to the remote system (except key forwarding, use Sneakernet ) which passwords need to be. Passwords are generally, predictably, unavoidably weak. While it is possible to have strong passwords, time and again it has been shown that people will use weak passwords and have poor password practices... short, simple, word-based, simple patterns ("p@ssw0rd!"), write them down, use them on multiple sites, base them on their phone number, their children's birthdate, their own name. You point out that keys don't expire, but why do passwords expire? To ensure that a brute-force attack is less likely to crack a password before it's been replaced. Not an issue that impacts keys.And, bad passwords aside, even "good" passwords are vulnerable to brute-force (online or offline) under the right conditions. They have to get transmitted to the other system, or to any other place that the user can be fooled into sending them by mistake.The balance of evidence strongly suggests that passwords are weaker and keys are stronger. - gowenfawr http://security.stackexchange.com/questions/69407/why-is-using-ssh-key-more-secure-than-using-passwords



For more info please check out
https://www.raspberrypi.org/forums/viewtopic.php?f=49&t=133318

<p>Hey nfarrow, I'm pretty new to this and know very little about linux or ssh so please bear with me.</p><p>I'm using ubuntu core on a pi 3 and have connected it to my network with a lan cable. When I try to logon with my email on the pi 3 it says &quot;no ssh keys found&quot;.</p><p>I know I need the ssh key to proceed but I'm getting stuck at the logon stage after connecting with putty.</p><p>I've tried pi as the username with a variety of passwords. I've tried ubuntu for username and password. I've tried leaving them blank but none are accepted...</p><p>Is there some other default logon area that I'm missing? Thanks</p>
Log on without using a ssh key and check if you see the .ssh folder in /home/ path.<br>use, &quot;ls -ltrh&quot; since .ssh folder would be hidden.<br><br>Either way I would recommend deleting the .ssh folder content and regenerating the keys and rerunning the commands.
<p>Also the default login for a Pi is</p><p>USER: pi</p><p>PASS: raspberry</p>

About This Instructable

425views

12favorites

License:

More by nfarrow:Raspberry Pi Running Unity Creating SSH Keys Programming an Arduino from Raspberry Pi 
Add instructable to: