Is it possible to log and/or restrict the source user of an ssh login?For example:user1@server1 logs into server2 as user2 . also, user3@server1 logs into server2 as user2 . By source user I mean user1 or user3 above.I would like to be able to track which session was initiated by user1@server1 and which session was initiated by user3@server1. The purpose for this is multiple users may be using the user2 account to e.g. manage processes on server2. (I realize there are security implications of this but part of this question is assessing the extent of those). As mentioned in the man page of sshd_config(5), sshd is capable of restricting access to a particular user using the AllowUsers config option in sshd_config. AllowUsersThis keyword can be followed by a list of user name patterns, separated by      spaces. If specified, login is allowed only for user names that match one of the patterns. Only user names are valid; a numerical user ID is not      recognized. By default, login is allowed for all users. If the pattern takes the form USER@HOST then USER and HOST are separately checked, restricting logins to particular users from particular hosts. The allow/deny directives are processed in the following order: DenyUsers, AllowUsers, DenyGroup, and finally AllowGroups.But the USER specified in the above man page seems to be describing the username on the TARGET machine (server2 in the example). I tested this by setting the AllowUsers option to user2@server1 , and found I was still able to login from user1@server1 -> user2@server2.  Also, the log does not seem to show any source user.This is the log /var/log/secure on RHEL6, after logging in from user1@server1 -> user2@server2Nov 17 16:14:59 server2 sshd[28349]: Set /proc/self/oom_score_adj to 0Nov 17 16:14:59 server2 sshd[28349]: Connection from 10.1.2.3 port 36508Nov 17 16:14:59 server2 sshd[28349]: Found matching RSA key: aa:bb:cc:dd:ee:ff:gg:..Nov 17 16:14:59 server2 sshd[28350]: Postponed publickey for user2 from 10.1.2.3 port 36508 ssh2Nov 17 16:14:59 server2 sshd[28349]: Found matching RSA key: aa:bb:cc:dd:ee:ff:gg:..Nov 17 16:14:59 server2 sshd[28349]: Accepted publickey for user2 from 10.1.2.3 port 36508 ssh2Nov 17 16:14:59 server2 sshd[28349]: pam_unix(sshd:session): session opened for user user2 by (uid=0)Nov 17 16:14:59 server2 sshd[28349]: User child is on pid 28351So, is there any way to (a) change the logging or behavior of sshd so that it will track the source user making the ssh connection? (b) restrict sshd to restrict connections based on the source user? 
log or restrict the source user of ssh login
ssh;login;sshd