RE: get logged in username



Do you have whoami available? If not try creating a temp file and then
using ls to examine who owns it. Then delete it when you're done.

-----Original Message-----
From: listbounce@xxxxxxxxxxxxxxxxx
[mailto:listbounce@xxxxxxxxxxxxxxxxx] On Behalf Of Mohsen Alimomeni
Sent: Thursday, September 17, 2009 2:45 AM
To: 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



Relevant Pages

  • Re: get logged in username
    ... If you're using a bash script, you could use "id", which will return ... How can I get the logged in username under remote command execution? ... myprog", I want to get the username inside the myprog. ...
    (SSH)
  • Re: get logged in username
    ... How can I get the logged in username under remote command execution? ... am using openssh version 4.0 under fedora core 4. ...
    (SSH)
  • get logged in username
    ... How can I get the logged in username under remote command execution? ... myprog", I want to get the username inside the myprog. ...
    (SSH)
  • Re: get logged in username
    ... How can I get the logged in username under remote command execution? ... doesn't work because no tty is created for the user. ...
    (SSH)
  • Re: get logged in username
    ... But suppose I want to execute a remote command "ssh admin@host ... myprog", I want to get the username inside the myprog. ... doesn't work because no tty is created for the user. ...
    (SSH)