First off, i do not know wether passing the information to the environment is the best approach, so i will start by detailing what i actually want to achieve.
on a corporate scale, there are servers where a number of employees have individual shell accounts, they are using these accounts to connect to other servers, using public-key authentication, logging in as root.
what i want to do, is be able, to tell, on the remote servers they are logging into, what the user account on the server they are coming from was.
for example user John Doe, has an account on central.server, he logs into his account jdoe, the jdoe user now connects to remote.server.1 and logs in as root with public-key auth.
I want to log the commands he is issuing on remote.server.1, but i want to retain the information that he is actually jdoe on central.server
So, basically i want to be able to pull a log from remote.server.1 and see which employee did what, when and where
I understand that i could just add some logging into the profile or bashrc on remote.server.1 and have sshd set up with PermitUserEnvironment, use a global profile on central.server and use that to pass the username in an environment variable to remote.server.1
I wonder if there is a better way to achieve that?
Thanks