Identifying User that raise custom command

0 votes
asked Nov 8, 2018 by Stony Kong (180 points)

The SFTP Server supports implementation of custom command via SSH session. If there is more than one user login to the Server, what is the proper way for the Server to identify the user that raise that custom command ?

1 Answer

0 votes
answered Nov 8, 2018 by Lukas Pokorny (123,810 points)

An instance of ShellCommandEventArgs passed to FileServer's ShellCommand event features a User property that identifies the user who raised the command:

server.ShellCommand += (sender, e) =>
    if (e.Command == "whoami")
commented Nov 8, 2018 by Stony Kong (180 points)
Dear Lukas,

Thank you for the information.

Best Regards,
Stony Kong
commented Dec 18, 2018 by IrekKrak (100 points)
That's what I was looking for. Thank you