getpwuid vs. getpwnam
Bob Proulx
bob at proulx.com
Sat Dec 4 02:50:10 EST 2004
John Cecere wrote:
> Please respond directly.
> [...]
> After building and installing openssh, I was having trouble getting my
> RSA authentication to work. In investigating it, I noticed that it was
> attempting to use /.ssh/id_rsa.pub as my public key file instead of
> /export/home/rjohn/.ssh/id_rsa.pub.
Confused here. Do you mean id_rsa or id_rsa.pub? I would have
expected you to say id_rsa here and not the .pub file.
> Wouldn't it be more appropriate to use something like
> getpwnam(getenv("LOGNAME")) instead ?
That would definitely break a lot of my scripts. We also have
multiple root users here. But we rely upon the fact that the file
~root/.ssh/id_rsa is the one and only root identify file.
Wouldn't it be reasonable to use the -i option?
ssh -i ~bob/.ssh/id_rsa somehost ...
That allows you to use whatever identity file you wish to use.
> Since the login program itself (in both Linux and Solaris) sets
> LOGNAME, it's a reasonably safe assumption that it will get set
> correctly.
Some systems say LOGNAME. Some systems say USER.
Bob
More information about the openssh-unix-dev
mailing list