Skip to content
Advertisement

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.

Advertisement

Answer

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

serverSession.getIoSession().getRemoteAddress()
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement