Re: get logged in username



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



Relevant Pages

  • Re: get logged in username
    ... custom nss module. ... username - not the UID - to operate well. ... identifies a user uniquely, not its username. ... for example, if user "foo" and ...
    (SSH)
  • Re: Strange top(1) output
    ... This could affect the width of the USERNAME ... > users (and if it's not there is always they UID view). ... I'm currently trying to get top to display ... prstatcommand of recent Solaris versions. ...
    (freebsd-stable)
  • Re: How do I get the user name from the uid?
    ... I'm looking for the opposite of the 'id' command. ... Where's the UID for which the OP wants to get the USERNAME? ...
    (comp.os.linux.misc)
  • Re: Commands for changing ownership of a file
    ... and besides os.chown(where you ned the uid and gid), you could also use subprocess.callor subprocess.Popen ... ownership of the files created in the script to that of my username. ... the command is something like "chown myusername:users". ... A-1090 Wien, AUSTRIA cmp.mpi.univie.ac.at ...
    (comp.lang.python)
  • Re: How do I get the user name from the uid?
    ... I'm looking for the opposite of the 'id' command. ... Where's the UID for which the OP wants to get the USERNAME? ...
    (comp.os.linux.misc)