Frage

Not sure what causes this...

system: OSX 10.9.2 shell: zsh with oh-my-zsh in tmux

> echo $HOME
/Users/xxmplus
> echo ~
/Users/xxmplus
> echo ~xxmplus
/home/xxmplus

This is annoying because my ssh does not work properly...

> ssh -T xxmplus@github.com
Could not create directory '/home/xxmplus/.ssh'.
The authenticity of host 'github.com (192.30.252.129)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/xxmplus/.ssh/known_hosts).
Hi xxmplus! You've successfully authenticated, but GitHub does not provide shell access.

Any suggestions? Thanks!

War es hilfreich?

Lösung

The most probable cause is that the home directory defined in the user database is different to what being set as $HOME by your profile and login scripts.

As for,

> echo $HOME
/Users/xxmplus
> echo ~
/Users/xxmplus

The above is strictly according to spec, a standalone ~ is simply defined to be $HOME in POSIX, so this proves little.

But this is different:

> echo ~xxmplus
/home/xxmplus

The spec says the following,

... the tilde-prefix shall be replaced by a pathname of the initial working directory associated with the login name obtained using the getpwnam() ... If the system does not recognize the login name, the results are undefined

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_01

So another quite unlikely option is that you’ve run into the undefined behaviour part of the spec – this can be the case when the login name (xxmplus) is not recognised on the box, specifically, it cannot be obtained with getpwnam(), however the simpler explanation is that it is there and you have to simply change the home directory in the user database.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top