2

Let's say we have a user account called john on a CentOS server (192.168.1.1) and on the other side we have a user who owns this account and from time to time uses his account from different locations (laptops) to SSH.

[jsmith@mac ~]# ssh john@192.168.1.1

[johnsmith@ubuntu ~]# ssh john@192.168.1.1

Now, here is the question:

On the server-side, is there any way to find out about the actual local user-id who launched the SSH client in order to initiate the SSH connection which means jsmith for the time that the user was using his Mac machine and johnsmith for the time that the user was using his Ubuntu machine.

Notes and cosideraitions:

  • I have root access to the server-side. I can install and configure any service if needed.
  • I do not have access to the client's machine and I can not ask him to use a specific SSH client or make any changes to his machine.
  • This is the closet post I was able to find. Using ident (xinetd) but the answer is not clear.

Get username of user who initiated SSH connection?

Thank You,

1 Answers1

2

No, not that's reliable from the server's point of view. As far as the server is concerned, the only information that identifies the user is their login.

The user might choose to send information about their remote user account. For example if they log in with a public key, the comment field in the key may identify them. But not reliably - there's no restriction on the content of that field. I guess they might also send their remote USER, HOME, or other environment variables that could identify their remote account, but this isn't something the server can enforce.

Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47