Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android bind to privileged port 22

I'm working on a custom Android device that needs to support ssh. We have a working service implemented that handles incoming ssh connections, but we have to run it currently on a port>1024 as per Linux permission requirements.

Is there a way to run the server on port 22?

Of course, we have system level access. We're trying to avoid exposing root access into the app space for security reasons. We do have a way to execute root commands, though if it's necessary.

like image 480
aravance Avatar asked Mar 24 '26 04:03

aravance


1 Answers

At this level Android is basically just linux so any information about linux will likely be applicable. Take a look at Is there a way for non-root processes to bind to "privileged" ports on Linux?, there is an accepted answer that seems to apply to recent versions of Android.

setcap(8) will just be making system calls, if it isn't available on Android you could bundle it or look at the source and make the same system calls.

like image 71
TomKeddie Avatar answered Mar 27 '26 13:03

TomKeddie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!