Public bug reported: The manual for ssh-keygen claims that by default it will create a key in ~/.ssh/id_rsa
The convention used in /bin/sh (and other shells) is that ~/.ssh/id_rsa is basically "$HOME/.ssh/id_rsa". So changing $HOME should change where ssh-keygen writes its key. But it does not. ssh-keygen seems to use the directory extracted from /etc/passwd. In this terminal session, I change the value of $HOME to illustrate this: $ HOME=/tmp sh $ cd ~ $ pwd /tmp $ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/drj/.ssh/id_rsa): ^C Versions etc: $ lsb_release -rd Description: Ubuntu 15.04 Release: 15.04 $ apt-cache policy openssh-client openssh-client: Installed: 1:6.7p1-5ubuntu1.3 Candidate: 1:6.7p1-5ubuntu1.3 Version table: *** 1:6.7p1-5ubuntu1.3 0 500 http://gb.archive.ubuntu.com/ubuntu/ vivid-updates/main amd64 Packages 500 http://security.ubuntu.com/ubuntu/ vivid-security/main amd64 Packages 100 /var/lib/dpkg/status 1:6.7p1-5ubuntu1 0 500 http://gb.archive.ubuntu.com/ubuntu/ vivid/main amd64 Packages ** Affects: openssh (Ubuntu) Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Server Team, which is subscribed to openssh in Ubuntu. https://bugs.launchpad.net/bugs/1527162 Title: ssh-keygen ignores $HOME To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/1527162/+subscriptions -- Ubuntu-server-bugs mailing list Ubuntu-server-bugs@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs