Re: get logged in username



In the last episode (Sep 17), Mohsen Alimomeni said:
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?

Try "whoami", or "id -un". Your system may also store the username for you
in the USER or LOGNAME environment variables.

--
Dan Nelson
dnelson@xxxxxxxxxxxxxxx



Relevant Pages

  • RE: 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. ... doesn't work because no tty is created for the user. ...
    (SSH)
  • Re: which
    ... usage: myProg command [args] ... I sure can change the interface since I'm the author of the entire program. ... 3/ check your user parameters before creating your SSHThread, and create your SSHThread with already validated parameters. ...
    (comp.lang.python)
  • Re: [opensuse] Native printing via SSH
    ... Because they are a kernel driver for the very tty your terminal is using, it's possible for the driver to do a little magic and provide virtual printer device files. ... It appears to be possible to tell dosemu to run a command to print. ...
    (SuSE)
  • Re: Query for blank passwords in Active Directory
    ... Depending on your Domain Controllers configuration, it may be extremely easy to enumerate users, even without having credentials for accessing the AD domain. ... If rpcclient's "enumusers" command doesn't work, it may still be possible to get the users list scanning for SIDs. ... If you're stuck on Windows as testing plaform, you should also take a look at enum.exe. ... username as well as username = password). ...
    (Pen-Test)
  • Re: Using NET SEND for a pop-up box
    ... Why not use a batch file and some ECHO commands instead? ... I've done a bit of testing and found that NET SEND <username> ... Sc.exe config "messenger" start= auto ... The first part is using the SC command Microsoft released to make sure ...
    (microsoft.public.win2000.networking)