Hi, Thanks for reply, This is the exact scenario: When I use the command "ssh admin@host", the user is authenticated by a custom Pam module, and it's given the UID, GID and shell from a custom nss module. The shell is also a custom CLI, which needs the username - not the UID - to operate well. I can't get the username from UID since there is no one-to-one correspondence between them. Also the commands: who, id and .. doesn't give me the username, since there is no tty for the session. Regards, Mohsen On Thu, Sep 17, 2009 at 9:28 PM, Schaff Mark-C00070 <mark.schaff@xxxxxxxxxxxx> wrote: > What are trying to do. Need information . > > Thank you > > Mark Schaff > Sent from my mobile > > -----Original Message----- > From: Mohsen Alimomeni <m.alimomeni@xxxxxxxxx> > Sent: Thursday, September 17, 2009 12:18 PM > To: secureshell@xxxxxxxxxxxxxxxxx <secureshell@xxxxxxxxxxxxxxxxx> > Subject: get logged in username > > Hi, > > How can I get the logged in username under remote command execution? I > am using openssh version 4.0 under fedora core 4. > > more explanation: > when I do "ssh admin@host", I can get the username "admin", by the > command "who -m", since there is tty which the username is assigned to > it. But suppose I want to execute a remote command "ssh admin@host > myprog", I want to get the username inside the myprog. The command > "who -m", doesn't work because no tty is created for the user. > How can I get the username in this case? > > Regards, > -- > __ \ /_\\_-//_ Mohsen Alimomeni > -- __ \ /_\\_-//_ Mohsen Alimomeni