0 votes
by (230 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
by (144k 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")
    {
            e.WriteLine(e.User.Name);
    }
};
by (230 points)
Dear Lukas,

Thank you for the information.

Best Regards,
Stony Kong
by
That's what I was looking for. Thank you
...