Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Check identity of remote-user after password-less ssh-login?

    After password-less ssh-login, is there any way in Linux to retrieve the identity of the remote-user that logged in?

    I would like to take some different actions in the login-scripts, depending on from which remote host/userid I do ssh-login.

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Hi and welcome

    The uid, gid etc can be found by calling the command "id"
    and the ssh connection details can be found in the environment variable SSH_CONNECTION.
    You must always face the curtain with a bow.

  3. #3
    The command
    who am i
    provides information about the current login, including the host from which an ssh session has been launched.

    I don't believe there's a way to find out the login ID on the remote host (i.e. if I log in to host W from host X where I have userid Y, host W doesn't have a way of determining userid Y. However, host W does know that you came from host X).

  4. $spacer_open
  5. #4
    Thanks for tips.
    Unfortunately, the hostname only didnt help here, since we login through a common proxy.
    But I now found a workaround, to login as:

    ssh -t user@server '/bin/bash --rcfile .customrc -i'

    It will then do a normal login, but will execute a different login-file than .bashrc, where I can put the custom-commands.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts