pwrusr.com

  • Home
  • Download
  • About
  • Contact

[amatesi@pwrusr.com:~]$->  sudo su

Andrea Matesi

My name is Andrea and I'm a flexible ICT specialist. I use this blog to catalog and organize my various activities, helping me not to forget. English is my favourite language, although everyone is welcome.

View Andrea Matesi's profile on LinkedIn

Support my blog <3

Tweets by @amatesi

feel free to middle-click any of these…

tricks under my sleeve.

ActiveFTP+NAT+iptables add-raid1md2running at 12.45 halt +ctrl+shft+d burnISO-RClick=isorecorder.alexfeinman.com CentOS-Upg debian usb boot dec2bin grub-splashimages h-v-fast-diff-vm-deployment hw-loop-adapter ie:jscript=actve-scrptng ifcfg-eth0=1:etc-syscfg-nw-scripts-ifcfg-eth0 ifcfg-eth0=2:ln etc-syscfg-nw-scripts-ifcfg-eth0 etc-syscfg-nwking-devs ifcfg-eth0=3:ln etc-syscfg-nw-scripts-ifcfg-eth0 etc-syscfg-nwking-profiles-default ipconfig /flushdns Joomla joomla-flsh-intro LANdebian mirror lvm-scan:vgscan | vgchange -a y m6600 ncq ich9 ahci xp nocti120 ntfsclone1:dmpPartTable=sfdisk -d /dev/sdb > /bck/partition-table.dmp nwn2+wine nwn2-motb-wine ospf-easy-topo phpmyadmin-adminer pwdless-putty pwdless-ssh pwdless-sshd+freenx rbt-2210 ubuntu rndc flush rsync -aHvzh --progress SRC DST scancodemap-disblPgUpPgDn ssh-keygen -b 4096 svchost.exe-groups:tasklist /svc svchost.exe-reg:HKLM-SW-MS-WinNT-CurVer-Svchost synology-block-lvl-synch sys-restore-Win2k8r2 ubu-upg sudo do-release-upgrade win-pwd-reset WinDevMgrErrCode31 xhtml xp-clone2nwhdd+sysprep+new-mb xp-ide2sata-clone+hack

Andrea on Google+

Creative Commons License
This work by Andrea Matesi is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

Howto SSH from Windows to Linux without Password by using PuTTY.

April 22nd, 2012 by Andrea Matesi 622 Views

Intro.

Anytime you have to gain access FROM this Windows box to that Linux box, copy/pasting that non-sense password into PuTTY is tedious, frustrating and time-consuming.

But there is always a way to improve your productivity. You'll just need to put your SSH keys to good use.

This 3-way process will allow you to gain access to your favourite OpenSSH Server-enabled Destination *NIX Box without having to re-type your usual password anytime (this is aka passwordless SSH access).

It works this way:

  • First you'll have to generate your keys.
  • Then you'll copy one of your keys to the destination Linux box.
  • Verify if it works.

But bear with me: It'll be a very basic tutorial.

Generate keys with PuTTYgen.

The process involves two systems: your average SOURCE Windows box (be it XP, Vista or 7 or successors doesn't matter, as soon as PuTTY & Co. works for you), and your average DESTINATION Linux box.

Download and install PuTTY with the included installer (I am suggesting you the installer because you'll also need the other "P-programs" enclosed).

ue puttygen to generate your key pair.

Execute PuTTYgen.exe to generate a new key (no need to use this program every time, it's just a "use-and-forget" kind of toy).

To generate a new key, from the main screen, over the "Parameters" section, make sure "SSH-2 RSA" is selected, then press the "Generate" button: an increasing progress bar will appear. Make some "digital noise" (ie.move your mouse in and around the bar to generate some human randomness for your key).

Once the bar is full, you will be presented with your scratchy new key. Input a comment for your key (ie.joe@myWinBox).

this is your PPK, select the public lines and paste them in linux

You'll need to save this key somewhere. Push the "Save private key"-button and browse for a sane place where to store it (ie,"C:\Documents and Settings\Joe\my\super\secret\folder\with\ssh\keys" -- so nobody will find it!).

Don't close PuTTYgen yet, keep it open (or reduce it to icon), because you're going to need it again.

Now let's focus our attention to the Linux server you're willing to gain access to.

Execute PuTTY as usual and just LOAD your saved session (don't open it yet), since we're going to configure some options.

Save you LINUX username into PuTTY.

From the selection tree, choose the "Connection" -> "Data" branch and type your linux username inside the "username" textarea  so you won't have to type it again every time.

Where to specify your key path such as PuTTY can use your keys.

Expand the "SSH" branch and choose "Auth" ("Connection" -> "SSH" -> "Auth"), then click the "Browse…" button to point it to your PPK-file.

Return to your main PuTTY screen ("Session") and SAVE your profile, then, finally, Open the session to your remote linux host and gain access to it with your password (as usual).

Copy the generated keys to your destination host.

At this point, you'll need to copy the public key section content from PuTTYgen to your remote Linux host, so you won't have to type your password again.

"cd" to your home folder (ie./home/andy) and open the "authorized_keys" file (ie. nano .ssh/autorized_keys).

Back on your Windows box, from PuTTYgen, select the public key part with your mouse, copy it then paste it inside the "authorized_keys" file you just opened previously with PuTTY/nano. An important thing to take care at this step is to look for the CRs an LFs. Make sure your public key lies on a SINGLE LINE (verify with your "Home" and "End" keys).

Verify…

Once you're sure you copied your key correctly.

Close your remote session and reopen it: if you're not asked for a password, then it worked, else…wash, rinse and repeat until it works!

ubuntu

Good achievement passwordless SSH, uh?

Bonus TIP: Have your NumLock perform correctly!

Once you're at PuTTY customizations, why not have your keypad work as intended?

When left at default, PuTTY will use your Keypad to send some escape sequences.

This tip will simply disable this feature.

You'll simply go to "Terminal" -> "Features" then check the "Disable application keypad mode" and Save!

Disable application keypad mode for NumLock to work as expected!

Posted in LINUX, Microsoft, System Administration, Tips and Tricks. | No Comments »

Typography++ by Andrea Matesi design by Six Shooter Media Sponsored by Web Hosting Provider