SSH port forwarding: “Privileged ports can only be forwarded by root” error

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I wanted to forward my local 8080 port to the 80 port of the server I want to log in via SSH, so I did:



ssh -L 80:127.0.0.1:8080 -N -f myserver


But I get the error:



Privileged ports can only be forwarded by root.


I can execute sudo commands when logged in that server, but how can I do it for the purposes of port forwarding? (Note: appending sudo at the beginning of this command doesn't help, because the port 80 is not the port I want to use in localhost, but the port I want to target.)










share|improve this question

























    up vote
    0
    down vote

    favorite












    I wanted to forward my local 8080 port to the 80 port of the server I want to log in via SSH, so I did:



    ssh -L 80:127.0.0.1:8080 -N -f myserver


    But I get the error:



    Privileged ports can only be forwarded by root.


    I can execute sudo commands when logged in that server, but how can I do it for the purposes of port forwarding? (Note: appending sudo at the beginning of this command doesn't help, because the port 80 is not the port I want to use in localhost, but the port I want to target.)










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I wanted to forward my local 8080 port to the 80 port of the server I want to log in via SSH, so I did:



      ssh -L 80:127.0.0.1:8080 -N -f myserver


      But I get the error:



      Privileged ports can only be forwarded by root.


      I can execute sudo commands when logged in that server, but how can I do it for the purposes of port forwarding? (Note: appending sudo at the beginning of this command doesn't help, because the port 80 is not the port I want to use in localhost, but the port I want to target.)










      share|improve this question













      I wanted to forward my local 8080 port to the 80 port of the server I want to log in via SSH, so I did:



      ssh -L 80:127.0.0.1:8080 -N -f myserver


      But I get the error:



      Privileged ports can only be forwarded by root.


      I can execute sudo commands when logged in that server, but how can I do it for the purposes of port forwarding? (Note: appending sudo at the beginning of this command doesn't help, because the port 80 is not the port I want to use in localhost, but the port I want to target.)







      ssh sudo openssh port-forwarding






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 29 at 8:20









      knocte

      1291110




      1291110




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          You probably want



          ssh -L 8080:127.0.0.1:80 -N -f myserver


          Local port comes first. (That's not my political stance!)






          share|improve this answer




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f465449%2fssh-port-forwarding-privileged-ports-can-only-be-forwarded-by-root-error%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            3
            down vote



            accepted










            You probably want



            ssh -L 8080:127.0.0.1:80 -N -f myserver


            Local port comes first. (That's not my political stance!)






            share|improve this answer
























              up vote
              3
              down vote



              accepted










              You probably want



              ssh -L 8080:127.0.0.1:80 -N -f myserver


              Local port comes first. (That's not my political stance!)






              share|improve this answer






















                up vote
                3
                down vote



                accepted







                up vote
                3
                down vote



                accepted






                You probably want



                ssh -L 8080:127.0.0.1:80 -N -f myserver


                Local port comes first. (That's not my political stance!)






                share|improve this answer












                You probably want



                ssh -L 8080:127.0.0.1:80 -N -f myserver


                Local port comes first. (That's not my political stance!)







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Aug 29 at 9:02









                Gerard H. Pille

                1,304212




                1,304212



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f465449%2fssh-port-forwarding-privileged-ports-can-only-be-forwarded-by-root-error%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay