Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7981881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:30:34+00:00 2026-06-04T10:30:34+00:00

In order to open a socket on a port < 1025 i need root

  • 0

In order to open a socket on a port < 1025 i need root access. Exactly how do i give my application this priviledge? I know i can run the su command in a shell to get root access, but is that all i need to do to open a socket on a port < 1025? Or do i need to run some sort of command like su open socket 0.0.0.0:80 or something? I am so confused as there are such little resources out there for this. What is the purpose of google not pre-rooting all of their devices?

Here is what i know i can do to get root access. http://www.youtube.com/watch?v=jmfvX8zvsS0&list=UUk1SpWNzOs4MYmr0uICEntg&index=4&feature=plcp

EDIT: I just wrote this:

public class RootTestActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Button button = (Button)findViewById(R.id.button);
    button.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            String cmds[] = {"su", "-c", "ls /system/app"};
            Shell shell = new Shell();
            String text = shell.sendShellCommand(cmds);
            TextView textView = (TextView)findViewById(R.id.textView);
            textView.setText(text);
            try {
                ServerSocket socket = new ServerSocket(80);
                Log.d("Root", "Opened socket on port 80!!!");
            }catch(Exception e) {
                Log.d("Root", "Failed to open socket on port 80!!!");
                e.printStackTrace();
            }
        }

    });
  }
}

What this does is it runs the commands su, -c, and then ls /system/app when a button is clicked. Then it gets the output and shows it on a textview (which actually works. I got the su prompt and selected accept and it listed everything in /system/apps/). But then after that i attempt to open a socket on port 80 and it still says Permission Denied. The application has root access, but still cannot open the socket! In the logcat it printed out “Failed to open socket on port 80!!!” as i told it to do when the exception is caught. What can i do to open the socket on port 80 without permission denied?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T10:30:36+00:00Added an answer on June 4, 2026 at 10:30 am

    As per https://serverfault.com/questions/112795/how-can-i-run-a-server-on-linux-on-port-80-as-a-normal-user

    I ran this command as root:

    iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
    

    And it worked! I opened a socket on port 8080 and when connecting to my phone on port 80 all traffic got redirected to 8080! WOW!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anybody advice me what I need to do in order to open ciphered
I am trying to open up a TCP socket in my client application so
My Android app has a button that executes this code in order to open
In order to open a modal dialog, you need to pass a parent window,
I found out that in order to open a Gmail compose screen you'd have
I am trying to create a table within PHP code in order to open
Is it possible to open a PDF from a website in Safari in order
In order to work with decimal data types, I have to do this with
So in Android/Java, I need to access a global variable that is an EditText[]
I need to run capybara-webkit inside a Rails application to enable headless web browsing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.