How to Access your Raspberry Pi via SSH over the Internet (port forwarding)

Поделиться
HTML-код
  • Опубликовано: 2 окт 2024
  • Learn how to port forward so you can access your Raspberry Pi via SSH from anywhere in the world over the internet.
    Find more at tonyteaches.tech
    Check out my vlog channel ‪@TonyFlorida‬
    #raspberrypi #ssh #portforwarding

Комментарии • 107

  • @prashanthb6521
    @prashanthb6521 Год назад +26

    One friendly suggestion. Please draw network diagrams and corresponding animations to explain how the ports are forwarded or where the ports are open and where it needs to be forwarded.

  • @Figworm
    @Figworm 2 года назад +27

    I know in the video, the file hi.txt was new, so :wq is perfectly fine. Tip: Get in the habit of using :x instead of :q or :wq with vi variants. When just reading/viewing a file, using :x will exit without modifying the file's timestamp (useful with backup solutions that use in part, file timestamps for backups). Where as :q will modify the file's timestamp, regardless if the file was edited or not. Also, :x acts the same as :wq for modified files.

    • @williamhdixon
      @williamhdixon 2 года назад +1

      I've always used ZZ with the vi editor. If you've changed anything, it saves and exits, just like :wq. But if you haven't changed anything, it just exits, leaving the original file untouched. For me, as long as it isn't one of those "oh no I made a mistake" moments, it's the same keystrokes whether I changed the time, or it looked okay once I got in and looked at it.

  • @anthonymclaughlin9222
    @anthonymclaughlin9222 2 года назад +5

    Thanks, great video really clearly explains the solution in only 8 minutes!!

  • @henkoegema6390
    @henkoegema6390 Месяц назад +1

    Well done !
    How do you show your phone on the screen ?
    Thanks

  • @zookoong8214
    @zookoong8214 2 года назад +2

    As a newbie, this video helps me perfect!!!!! Thanks I've subscribed and clicked thumbs up!!!!! Thanks!!!

  • @STMONDEO1
    @STMONDEO1 6 месяцев назад

    Hi Tony
    Thanks for the video about port forwarding.
    As i have been struggling to get my raspberry pi to work over the internet with port forwarding.
    Thanks for your video.
    Peter

    • @TonyTeachesTech
      @TonyTeachesTech  6 месяцев назад

      You're welcome! Thanks for subscribing

  • @bennicolai1063
    @bennicolai1063 2 года назад

    I rarely like stuff, but this gets one from me. Very good video, helped a lot. Thanks

  • @hemants337
    @hemants337 Месяц назад

    This is a great video. Thanks for making it. Could you also cover how to secure this connection, changing the ssh keys etc. TIA

  • @danieldenhartog2309
    @danieldenhartog2309 2 года назад +6

    Hi! Just a little heads up. I forwarded port 5900~5910:TCP on my modem (this port is for VNC) and was able to use my 'whatsmyIP' IP-adress as connection adress in VNC viewer. This was sufficient to be able to remotely control my RPi! For me, the SSH port did not work, so this might be a solution for anyone with the same problem! :) Cheers

    • @TonyTeachesTech
      @TonyTeachesTech  2 года назад

      Nice workaround :)

    • @timt2708
      @timt2708 2 года назад

      Weirdly, that worked, but ssh didnt. THANKS M8!

  • @kychemclass5850
    @kychemclass5850 5 месяцев назад +1

    Maybe they blocked port 80 to encourage you to use HTTPS on 443. Did you check if they allow 443?

  • @iflashlantern4292
    @iflashlantern4292 Год назад +8

    This video answered my questions perfectly. I just have one quick question. While researching port forwarding I've seen a lot of people online talking about risks to brute force attacks from outside. I just want to be able to SSH into and communicate over TCP with my raspberry pi while I'm in school. My pi is running Ubuntu Server 20.04.5. If I enable the firewall on my pi, do you think everything would be safe?
    Edit: nevermind, I found out I could just set the Ubuntu firewall (ufw) to only accept tcp connections (and ssh) over port 22 coming from specific IPs. i have it set to only accept form my router and my laptop's local (home network) ip address. once i get to school i'll add my computer's local ip from their network. i *think* this will be safe.

  • @nhs.14
    @nhs.14 Год назад +1

    what happen if you dont have static ip for your router? most isp wont give static ip for cheap internet subscription

  • @ArthursHD
    @ArthursHD Год назад +1

    don't expose SSH and RDP like this to the internet without hardening!

  • @Probler
    @Probler 11 месяцев назад +1

    This is a long time after u posted ur video but I really hope u see and answer my question.
    I don't really know and have my ip momorised at all times so I would like to connect to my ssh hosing my domain name, is that possible? And is there extra setup required or no?

  • @alaaalotaibi6201
    @alaaalotaibi6201 Год назад +3

    man this is really helpful, easy and straightforward

  • @Irkie_1
    @Irkie_1 3 месяца назад

    He just gave us his IP adress...... hope nobody DDos' him

  • @taleivenvencatalapillay2039
    @taleivenvencatalapillay2039 Год назад +1

    can you tell me how to give someone access to your pi using your router

  • @chandandhiman8057
    @chandandhiman8057 4 месяца назад

    This will only work with static ip not dynanic ip aadress

  • @ryandickinson4738
    @ryandickinson4738 2 года назад +1

    Do you need a static ip address to do any of this ?

  • @filipk729
    @filipk729 2 года назад +4

    Perfect, this it exactly what I was looking for. Answer to all my questions related to the remote ssh. Thank you kindly!

    • @TonyTeachesTech
      @TonyTeachesTech  2 года назад +1

      You are welcome!

    • @andymann6061
      @andymann6061 2 года назад

      Me too!

    • @ArthursHD
      @ArthursHD Год назад

      Don't expose SSH and RDP like this to the internet without hardening!

  • @satejratnaparkhi
    @satejratnaparkhi Год назад

    How to make router ip static without purchasing??
    I tried some services like no-ip but when the router reboot or sometimes later the public IP get's changed and if I'm outside I don't know the public IP of my router then how I can ssh cause no ip also not changing the previous ip to new.
    Plz help......

  • @THE_PERSON4204
    @THE_PERSON4204 5 месяцев назад

    bro just revealed his full ip adress💀💀

  • @doomtomb3
    @doomtomb3 4 месяца назад

    no mention of security. there's bot farms out there checking all IPs they can find for port 22. Then they gonna brute force your usernames like root, admin, etc. Linux does not recommend changing root username, so you are kind of stuck. You could at least use a random port for ssh instead of 22.

    • @TonyTeachesTech
      @TonyTeachesTech  4 месяца назад

      Security by obfuscation is not a good technique

    • @Nocrappycoffee
      @Nocrappycoffee Месяц назад

      You can disable root login by modifying /etc/ssh/sshd_config and enforce login only with Public Keys which make brute force very expensive. But probably you will also need some firewall protection against floods.

  • @billloveless6869
    @billloveless6869 2 года назад

    Do you have to use the ports you listed? Thanks

  • @taleivenvencatalapillay2039
    @taleivenvencatalapillay2039 Год назад

    can you pls tell me how to give someone access to your pi with your public ip

  • @leozhang1340
    @leozhang1340 7 месяцев назад

    Is that port number 22 you entered the internal or external port? I have both available for me to edit.

  • @joseponce9567
    @joseponce9567 3 года назад +1

    Nice video, I suposse if you have an active NGINX server running in the Raspberrypi, you will access directly to the web service developed?

    • @TonyTeachesTech
      @TonyTeachesTech  3 года назад

      Not sure I understand your question, but I do have a video about accessing an Nginx site on Pi here ruclips.net/video/AFeye1zLpFo/видео.html

  • @daurham
    @daurham 2 года назад +1

    Great video!
    Will running a server on this port allow me to connect to it? Or is SSH different in some fundamental way?
    I’ve only used it for remote connecting, so the concept isn’t landing for me

    • @shriram5494
      @shriram5494 2 года назад

      you could run a server on port 22 and connect to it through the url ipv4address:22 on your web browser

  • @Lp-ze1tg
    @Lp-ze1tg 3 года назад

    Would that be a problem if the user plans to setup IPFire on the same network?

  • @miloszfedorowicz5382
    @miloszfedorowicz5382 2 года назад

    Is this safe ? I mean every other tutorial to do this uses a VPN, I don't know why if it's that simple !

  • @nicofish1000
    @nicofish1000 2 года назад

    thank you. I had my ssh server locally, but now that we can leave our houses again I need to be able to access it from elsewhere.....

  • @illumi1749
    @illumi1749 Год назад

    on my router it says to input a LAN and WAN port should i just do 22 for both

  • @MPElectronique
    @MPElectronique Год назад

    Hey, thanks for the video.
    Is it possible to access multiple local webserver??

  • @devtest8259
    @devtest8259 2 года назад

    You can make a new port number and assign it to http requests. Nothing they can do to stop it.

  • @jonathanflores3748
    @jonathanflores3748 5 месяцев назад

    Not all the tutorials go as smooth as this one, even though I had another internet supplier it still worked fine. Thank you for the help.

  • @cheapproductions6389
    @cheapproductions6389 Год назад

    hopefully he's using a VPN

  • @gene_Code
    @gene_Code Год назад

    if you ISP gave u a NAT'ed IP address to your router then it is impossible to do port forwarding.

    • @tngdwn8350
      @tngdwn8350 8 месяцев назад

      Yeah, I faced this problem, at least I think so. Do you know if it's possible to circumvent it by using IPv6? Somehow I failed using IPv6.

  • @airbus5717
    @airbus5717 Год назад

    if i have a pdf on the raspberry pi how do i view it on the phone?

  • @delmoteperrin6584
    @delmoteperrin6584 3 года назад +1

    But what I can do if the raspberry is connected with a 4G modem?

    • @TonyTeachesTech
      @TonyTeachesTech  3 года назад

      Can you port forward on your modem?

    • @delmoteperrin6584
      @delmoteperrin6584 3 года назад +1

      @@TonyTeachesTech I don't know how to do this. It's a USB modem 4 G

  • @DrsJacksonn
    @DrsJacksonn Год назад

    Can you also use other ports than 22?

  • @garokejelian565
    @garokejelian565 Год назад

    Thanks you solved my problem with a simple explanation

  • @UmeshMane-q5o
    @UmeshMane-q5o 6 месяцев назад

    Can we connect VNC as well ?

  • @tomcobb1829
    @tomcobb1829 2 года назад

    "St. Ignatius..." you a Jesuit?

  • @ignaciohdi
    @ignaciohdi 2 года назад

    Is there any kind of risk for doing this on a RaspberryPi 4, i don't think Raspberry has a firewall, and if it has it, it might not be as safe as the one in windows 10

  • @astroid9087
    @astroid9087 2 года назад

    If I want to ssh to 2 rpi How do I choose which one? 🤔 👍

  • @timgiaychuyenadidasreal4800
    @timgiaychuyenadidasreal4800 2 года назад

    how to enter wifi password for raspberry through phone using app or webserver??

  • @meeskees4227
    @meeskees4227 9 месяцев назад

    What to do if you have multiple raspberry pi’s?

    • @dailyfunnierfacts
      @dailyfunnierfacts 6 месяцев назад

      u just change the hostname of the each raspberry pi differely

  • @osm4834
    @osm4834 Год назад

    how do i do it with an arris att router

  • @iliketodostuff123
    @iliketodostuff123 2 года назад

    Umm my guy just showed us his public ip witch anyone can us to track him.

    • @TonyTeachesTech
      @TonyTeachesTech  2 года назад

      No worries, that was a temp IP that I'm no longer associated with :)

  • @yktserea2214
    @yktserea2214 Год назад

    Xh

  • @miningcraft1122
    @miningcraft1122 Год назад

    you should blur the IP address to avoid any DDoS

    • @tngdwn8350
      @tngdwn8350 8 месяцев назад

      Nah, the IP is changing. When he uploaded the video it wasn't "his" IP anymore.

  • @yktserea2214
    @yktserea2214 Год назад

    Bluh

  • @lukasthielen302
    @lukasthielen302 3 года назад

    great job. can you also set up two individual server/raspberry pi in your local network and access them both via port 22 or should each use a dedicated port?

  • @vaibhavpatil9956
    @vaibhavpatil9956 2 года назад

    Thanks Tony!!

  • @brunomattosrj
    @brunomattosrj 2 года назад

    Tony, you are incredible!

  • @hasanmuhammod
    @hasanmuhammod 3 года назад +2

    Hey, will it work if I don't have a real ip? Cause I have a shared ip

    • @TonyTeachesTech
      @TonyTeachesTech  3 года назад +1

      As long as you have ssh access (with a username and password) to the server

  • @koka5491
    @koka5491 2 года назад

    Thank you, i've been searching for a solution forever

  • @thomasperri3294
    @thomasperri3294 2 года назад

    Is this safe to do? Is a VPN recommended?

    • @TonyTeachesTech
      @TonyTeachesTech  2 года назад

      A VPN won't help in this case. There is risk anytime you open a port to your local network.

  • @sciencekhuong
    @sciencekhuong 2 года назад

    Can you port forwarding proftpd?

  • @RazahLP
    @RazahLP 2 года назад

    Thank you, very helpful!

  • @johnb6767
    @johnb6767 Год назад

    Thanks Tony

  • @OskarNy97
    @OskarNy97 3 года назад

    Thanks a lot! :-)

  • @jonny777bike
    @jonny777bike 3 года назад

    How long that address though

    • @TonyTeachesTech
      @TonyTeachesTech  3 года назад

      What?

    • @jonny777bike
      @jonny777bike 3 года назад

      @@TonyTeachesTech I guess I didn't fully ask the question. How long does that address last. I really need to learn how to do Dynamic DNS. I still can't understand why we would need dynamic addresses with IPv6.

    • @TonyTeachesTech
      @TonyTeachesTech  3 года назад

      @@jonny777bike That will depend on the lease time defined by your internet service provider

  • @villocity5794
    @villocity5794 2 года назад

    hehe cox hehehe