代码之家  ›  专栏  ›  技术社区  ›  Charles Ouellet

使用ssh keygen创建ssh密钥不会创建.ssh文件夹

  •  20
  • Charles Ouellet  · 技术社区  · 15 年前

    我正在尝试用msysgit创建我的公共/私有RSA密钥对

    我运行这个命令:

    ssh-keygen -C "email@email.com" -t rsa
    

    一切看起来都很好,我有消息

    Enter file in which to save the key (/c/Users/user/.ssh/id_rsa)
    

    然后我得到确认:

    Your public key has been saved in project.pub
    

    但我无法访问文件夹!它不存在,甚至不是隐藏文件夹。我不明白为什么它不能产生。我正在使用Windows 7 Ultimate。

    3 回复  |  直到 9 年前
        1
  •  26
  •   VonC    15 年前

    刚刚创建了我的密钥,没有任何问题(7个64位的终极版本,msysgit 1.6.5.1.1367.gcd48)

    $ ssh-keygen -C "vonc@xxxx" -t rsa
    Generating public/private rsa key pair.
    Enter file in which to save the key (/c/Users/VonC/.ssh/id_rsa):# just press enter
                                                                    # to accept the
                                                                    # default location
    Enter passphrase (empty for no passphrase):                     
    Enter same passphrase again:
    Your identification has been saved in /c/Users/VonC/.ssh/id_rsa.
    Your public key has been saved in /c/Users/VonC/.ssh/id_rsa.pub.
    The key fingerprint is:
    xx:yy:zz:aa:bb:cc:... vonc@xxxx
    

    结果是:

    VonC@P ~/.ssh
    $ ls -alrt
    total 10
    -rw-r--r--    1 VonC Administ      642 May 23 21:47 known_hosts
    drwxr-xr-x   43 VonC Administ    16384 Jun 15 17:01 ..
    -rw-r--r--    1 VonC Administ      398 Jun 19 16:14 id_rsa.pub
    -rw-r--r--    1 VonC Administ     1675 Jun 19 16:14 id_rsa
    drwxr-xr-x    2 VonC Administ        0 Jun 19 16:14 .
    

    你能看看你的bash会话吗? $HOME 是否设置了环境变量?

    VonC@P ~/.ssh
    $ env|grep HOME
    HOMEPATH=\Users\VonC
    HOME=/c/Users/VonC     # <=== this must be correctly set
    HOMEDRIVE=C:
    
        2
  •  8
  •   Amit    9 年前

    我也遇到了同样的问题,当它要求输入以下“输入要保存密钥的文件(c/users/user.name/.ssh/id_rsa)”时,我意识到我试图输入一个文件名。

    相反,只需输入Nothing,然后按Enter键使用默认值,您将继续。

        3
  •  0
  •   Aparna    11 年前

    这对我很有效。请参阅下面的链接

    http://ekawas.blogspot.co.uk/2007/03/solving-pesky-ssh-issues-in-cygwin.html

    在c:/cygwin64/etc中编辑passwd文件。用wordpad打开它。

    将home/your\u name编辑为/cygdrive/c/documents and settings/your\u name