javasshsftpapache-mina

Is it possible to get IP address of SSH/SFTP client via Apache Mina SSHD ServerSession?


I create SFTP server using Apache Mina SSHD. I want to find out the client IP when they connect to my server (via FileZilla, WinSCP). However, while I tried to found it in ServerSession, I could not.

Where can I find this information?

Thank you.


Solution

  • Use ServerSession.getIoSession to retrieve an IoSession instance. And on that, call IoSession.getRemoteAddress():

    serverSession.getIoSession().getRemoteAddress()