bugzilla-daemon at mindrot.org
2003-Aug-09  17:07 UTC
[Bug 623] ssh, ssh-keygen and possibly others do not honour $HOME
http://bugzilla.mindrot.org/show_bug.cgi?id=623
           Summary: ssh, ssh-keygen and possibly others do not honour $HOME
           Product: Portable OpenSSH
           Version: 3.6.1p2
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ssh
        AssignedTo: openssh-bugs at mindrot.org
        ReportedBy: kalin at ThinRope.net
I had quite a time trying to figure out how to make openssh tools work on a
system with not unique uids... For different reasons I have a system with
several "root" accounts (uid 0).
Although in the man pages it is written:
    Normally each user wishing to use SSH with RSA or DSA authentication runs
    this once to create the authentication key in $HOME/.ssh/identity,
    $HOME/.ssh/id_dsa or $HOME/.ssh/id_rsa. Additionally, the system adminis-
    trator may use this to generate host keys, as seen in /etc/rc.
<above is from ssh-keygen>
$HOME is never used. Instead, the home from /etc/passwd [returned by
getpwuid(getuid))] is used in *TWO* places for ssh. I haven't cheked
ssh-keygen,
as it is not so critical.
So, any specific reasons why this is so?
I know this is the easy way (no error checking,etc.), but it is not the good
way. At least update the documentation.
I hacked a very dirty patch, please have a look. It can be improved a lot, I
know, but for an hour I came with only that.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
bugzilla-daemon at mindrot.org
2003-Aug-09  17:14 UTC
[Bug 623] ssh, ssh-keygen and possibly others do not honour $HOME
http://bugzilla.mindrot.org/show_bug.cgi?id=623 ------- Additional Comments From kalin at ThinRope.net 2003-08-10 03:14 ------- Created an attachment (id=366) --> (http://bugzilla.mindrot.org/attachment.cgi?id=366&action=view) _Dirty_ patch to allow non unique UIDs No checking whatsoever, trusting the enviroment, hardcoded 200 chars for $HOME, $LOGNAME... A lot to work on, but better than nothing as a start. ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.
bugzilla-daemon at mindrot.org
2003-Aug-10  07:19 UTC
[Bug 623] ssh, ssh-keygen and possibly others do not honour $HOME
http://bugzilla.mindrot.org/show_bug.cgi?id=623
------- Additional Comments From dtucker at zip.com.au  2003-08-10 17:19 -------
For a start, you don't need to malloc memory for or strdup the result of 
getenv, as it just returns a pointer to the environment space.  Instead of:
    original_user_home_dir=(char *)malloc(sizeof(char)*200);
    original_user_home_dir = getenv("HOME");
    pw->pw_dir = xstrdup(original_user_home_dir);
you can just have:
    pw->pw_dir = getenv("HOME");
I don't know that this patch is a good idea, though (auth.c also uses  
tilde_expand_filename and there's probably no environment when it's
called and
you shouldn't trust it even if there was).
I do agree that the man page for ssh-keygen is a little misleading.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.