mattwynne / ssh-forever

Smooth password-less SSH setup
MIT License
90 stars 9 forks source link

Expand '~/' to real path #3

Closed hedgehog closed 13 years ago

hedgehog commented 13 years ago

Some versions of ssh choke on ~/, and require the expanded path.

$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hedge/.ssh/id_rsa): ~/.ssh/id_rsa_cuken3    
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
open ~/.ssh/id_rsa_cuken3 failed: No such file or directory.
Saving the key failed: ~/.ssh/id_rsa_cuken3.

Compared to:

$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hedge/.ssh/id_rsa): /home/hedge/.ssh/id_rsa_cuken3
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/hedge/.ssh/id_rsa_cuken3.
Your public key has been saved in /home/hedge/.ssh/id_rsa_cuken3.pub.
The key fingerprint is:
6b:8c:a7:02:5c:d5:c3:bb:49:b3:50:8e:04:4f:ce:58 hedge@desktop
The key's randomart image is:
+--[ RSA 2048]----+
|    ..Eo         |
|     Bo =        |
|    .o++ o       |
|    . o =        |
| . .   oS=       |
|  o    o+.       |
|   .  . =        |
|    .  +         |
|     ..          |
+-----------------+

Possible soln:

require 'pathname'
Pathname('~/').expand_path.realpath
hedgehog commented 13 years ago

Closed by https://github.com/mattwynne/ssh-forever/pull/5