Results 1 to 4 of 4
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, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 01-02-2013 #1Just Joined!
- Join Date
- Jan 2013
- Posts
- 2
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.
- 01-02-2013 #2
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.
- 01-02-2013 #3Just Joined!
- Join Date
- Aug 2006
- Posts
- 16
The command
provides information about the current login, including the host from which an ssh session has been launched.Code:who am i
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).
- 01-03-2013 #4Just Joined!
- Join Date
- Jan 2013
- Posts
- 2
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.


Reply With Quote
