How To Control A Raspberry Pi Remotely From Anywhere In The World

How To Control A Raspberry Pi Remotely From Anywhere In The World

Ever wished you could access your Raspberry Pi when you’re on the road? Perhaps you’ve set up a home security camera, you’re running a private Minecraft server, or you’re using your Pi for some crazy hacked together internet appliance of your own making. Whatever your reasons, it’s easy than you think to access that Raspberry Pi remotely. Here’s how.

Illustration by Sam Woolley.

To access a Raspberry Pi (or any home computer for that matter) from outside your home network, you’d usually need to jump through a lot of hoops, get an IP address, and tweak a few settings on your home router. If you just need to control a few simple things on your Raspberry Pi, that’s overkill. We’re going to outline two methods that skip all of that.

The first thing you need to do is get your Raspberry Pi set up and connected to your home network. Since you’re exposing your Raspberry Pi to the internet, be sure you change your default password during the set up process. Once that’s done, come back here to set up everything else.

Remote Log Into Your Raspberry Pi’s Full Operating System Using VNC Connect

VNC has long been the best way to access any computer remotely on the same network. Recently, VNC Connect came out to make it easy to access your Raspberry Pi from anywhere using a cloud connection. Once it’s set up, you can access your Raspberry Pi’s graphic interface from any other computer or smartphone using the VNC Viewer app.

VNC Connect comes packed in for free with the most recent versions of the Raspberry Pi operating system, PIXEL. If you already have that, you can skip this part. If not, you can install it by opening up Terminal on your Raspberry Pi and typing in two commands:

  1. Type in sudo apt-get update and press Enter.
  2. Type in sudo apt-get install realvnc-vnc-server realvnc-vnc-viewer and press Enter.

Once that’s finished downloading, you can set up VNC Connect:

  1. Head to the RealVNC Raspberry Pi sign up page and enter your email address in the sign up box.
  2. Follow the on-screen instructions to finish setting up your account with a password.
  3. Back on your Raspberry Pi, click the VNC icon in the top-right corner of the screen to open VNC. Then click the status menu and select Licensing.
  4. Enter the email address and password you created in step one.
  5. When prompted, select “Direct and cloud connectivity.” Your Raspberry Pi is now accessible online.
  6. Download the VNC Viewer application on the computer you want to control the Raspberry Pi from, like the laptop or smartphone you’ll have when you travel.
  7. Open the VNC Viewer application and enter the credentials you created in step one.
  8. Your Raspberry Pi will pop up as an option automatically. Select it to open up the connection. When prompted, enter your Raspberry Pi’s username and password (by default this is the username pi and password raspberry). Within a few second it will connect.

You’re now able to log into your Raspberry Pi’s graphic desktop from anywhere as long as your Raspberry Pi has internet access. This means you can take control of any security software, check on the status of any projects you’ve set up, or play Minecraft on your private server.

Access the Command Line with Dataplicity

If you don’t need to access the full graphic interface, then you’ll want to check out Dataplicity. Dataplicity makes it incredibly easy to access your Raspberry Pi’s command line from any browser. You’ll need access to a web browser and your Raspberry Pi for this.

  1. Head to Dataplicity and create an account by entering your email address.
  2. Click Add New Device.
  3. Dataplicity will display a line of code as seen in the image above. Copy that line of code and enter it into the command line of your Raspberry Pi. You can do this on your Raspberry Pi by selecting opening the Terminal application or by accessing it remotely on your home network over SSH using a tool like Adafruit’s Pi Finder. After a few seconds, Dataplicity will download and install software on your Raspberry Pi that links it directly with your account.
  4. Once that’s complete, head to the Dataplicity device page. Here, you’ll see your Raspberry Pi. Click on it to open up a Terminal window.
  5. Right now, you can reboot and rename your Raspberry Pi, and that’s about it. If you just need to remotely reboot it sometimes, leave it as is. If you need to do more than that, like install software or edit files, you can sign in as a superuser. To do so, in the Dataplicity command line, type in, su pi and press Enter. Then, enter your Raspberry Pi’s password and press Enter. Now you have total control over your Raspberry Pi.

That’s it, you have complete access to your Raspberry Pi from anywhere in the world with an internet connection. Obviously your Raspberry Pi needs to remain powered on, but otherwise you can access it from any browser. You can do a ton of thing with this little feature out of the box, including: hosting a small web site, sharing files, and even streaming video.

This article originally appeared on Lifehacker.


The Cheapest NBN 50 Plans

It’s the most popular NBN speed in Australia for a reason. Here are the cheapest plans available.

At Gizmodo, we independently select and write about stuff we love and think you'll like too. We have affiliate and advertising partnerships, which means we may collect a share of sales or other compensation from the links on this page. BTW – prices are accurate and items in stock at the time of posting.