How to Control Your Raspberry Pi Remotely From Anywhere in the World
Ever wanted to access your Raspberry Pi on the go? You might have a home security camera installed, you have a private Minecraft server, or you are using your Pi for some crazy internet device you built. Whatever your reasons, remotely accessing your Raspberry Pi is easier than you might think. Here’s how.
To access your Raspberry Pi (or any home computer for that matter) from outside of your home network, you usually have 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 manage a few simple things on your Raspberry Pi, this is overkill. We’re going to outline two methods that miss all of this.
The first thing you need to do is set up your Raspberry Pi and connect it to your home network . Since you are publishing your Raspberry Pi to the Internet, be sure to change the default password during the setup process. Once that’s done, come back here to set up everything else.
Remotely log into your Raspberry Pi’s complete operating system using VNC Connect
VNC has long been the best way to remotely access any computer on the same network . VNC Connect recently came out which made it easy to access your Raspberry Pi from anywhere using a cloud connection. Once set up, you can access your Raspberry Pi’s GUI from any other computer or smartphone using the VNC Viewer app .
VNC Connect comes free with the latest Raspberry Pi operating system, PIXEL . If you already have one, you can skip this part. If not, you can install and enable it by opening Terminal on your Raspberry Pi and entering a few commands:
- Type
sudo apt-get update
and press Enter. - Type
sudo apt-get install realvnc-vnc-server realvnc-vnc-viewer
and press Enter. - When it’s complete, type
sudo raspi-config
and press Enter. Scroll down to VNC and set it to Enabled.
Once the download is complete, you can configure VNC Connect:
- Go to the RealVNC Raspberry Pi registration page and enter your email address in the registration field.
- Follow the onscreen instructions to complete setting up your password account.
- Back at your Raspberry Pi, click on the VNC icon in the upper right corner of the screen to open VNC. Then click the status menu and select Licensing.
- Enter the email address and password you created in the first step.
- Select “Direct & Cloud Connection” when prompted. Your Raspberry Pi is now available online.
- Download the VNC Viewer app on the computer you want to control your Raspberry Pi from, just like a laptop or smartphone you’ll have when you travel.
- Open the VNC Viewer app and enter the credentials you created in the first step.
- Your Raspberry Pi will appear as an option automatically. Select it to establish a connection. When prompted, enter your Raspberry Pi username and password (the default is
pi
username andraspberry
password). In a few seconds it will connect.
You can now log into your Raspberry Pi’s graphical desktop from anywhere as long as your Raspberry Pi has Internet access. This means you can take control of any security software, check the status of any projects you create, or play Minecraft on your private server .
Command line access with Dataplicity
If you don’t need a complete graphical interface, try Dataplicity . Dataplicity makes it incredibly easy to access the Raspberry Pi command line from any browser. To do this, you will need access to a web browser and a Raspberry Pi.
- Go to Dataplicity and create an account with your email address.
- Click Add New Device.
- Dataplicity will display a line of code as shown in the image above. Copy this line of code and enter it into the command line of your Raspberry Pi. You can do this on your Raspberry Pi, open the application “Terminal” or receiving remote access to your home network via SSH using a tool such as Adafruit Pi the Finder . In a few seconds, Dataplicity will download and install software on the Raspberry Pi that will directly link it to your account.
- Once this is complete, head over to the Dataplicity device page . Here you will see your Raspberry Pi. Click on it to open a terminal window.
- Right now, you can reboot and rename the Raspberry Pi, that’s all. If you just need to reboot it remotely sometimes, leave it as it is. If you need to do more, such as installing software or editing files, you can log in as superuser. To do this, at the Dataplicity command line, type
su pi
and press Enter. Then enter your Raspberry Pi password and press Enter. You now have complete control over your Raspberry Pi.
That’s it, you have full access to your Raspberry Pi from anywhere in the world with an internet connection. Obviously, your Raspberry Pi needs to stay powered on, but otherwise you can access it from any browser. You can do a ton of things with this little feature right out of the box, including hosting a small website , sharing files, and even streaming videos .