cancel
Showing results for 
Search instead for 
Did you mean: 

logname issue

 
Highlighted
Frequent Advisor

logname issue

I have a strnage issue with "logname" that doesn't seem to be reolveable by any of the previously posted solutions.

Our developers sudo su - and then at some stage they ssh to another development server. Through all of this, their "logname" needs to remain their username - for various loggin reasons.
On the initial server, this is not a problem, the logname command and $LOGNAME variable are always correct.

But when they ssh to the other server, one of two things happens:
1. logname: could not get login name (the logname is run from the .profile of the user)
2. It works, but the logname is the name of the user we ssh'd from (app_username), not the user's username.

It all seems very strange to me.

We're running HPUX 11.23 on Itanium servers.
3 REPLIES 3
Highlighted
Honored Contributor

Re: logname issue

"But when they ssh to the other server, one of two things happens:
1. logname: could not get login name (the logname is run from the .profile of the user)
2. It works, but the logname is the name of the user we ssh'd from (app_username), not the user's username."

so...they are still su'd to "app_username" when this occurs? If so, a simple "ssh new_server" is going to log you in there w/ the credentials of "app_username", so I would expect logname / $LOGNAME on the new server to a) work and b) return "app_username". Any connection to there real login id was lost with the ssh to the new target.

you could ssh to the new server with there original login by doing something like:
sss `logname`@new_server. At that point, it will log them in to the "new" server using their own id. They would then have to "su" again to "app_username". Then logname / $LOGNAME on the new server should be correct. Of course, that means the developers need accounts on the "new server" as well.
Highlighted
Frequent Advisor

Re: logname issue

You are 100% correct, but that just makes too much sense.

I thought that was the case myself, but I am assured by the lead developer - who has root access to both servers *SHUDDER* - that this used to work.
Highlighted
Honored Contributor

Re: logname issue

I can't think of any case where it wouldn't work as I described.

"assured that this used to work"...over ssh or some other method, like rlogin (although AFAIK thats going to use the "current" id as well)?

And since the "lead developer" has root access, the next question (to them) would be "So what did YOU break and how do YOU propose to fix it" :-)