Software & AppsOperating SystemLinux

How To Set Up Barrier to Run on Startup in Ubuntu 18.04 with SSL

Ubuntu 13

In this article, we will guide you through the process of setting up Barrier, an open-source software that allows you to share a single mouse and keyboard between multiple computers, to run on startup in Ubuntu 18.04 with SSL. This process involves creating a systemd service, ensuring the correct SSL certificates are in place, and troubleshooting any potential issues.

Quick Answer

To set up Barrier to run on startup in Ubuntu 18.04 with SSL, you need to create a systemd service, ensure the correct SSL certificates are in place, and troubleshoot any potential issues. This process allows you to share a single mouse and keyboard between multiple computers securely and efficiently.

Prerequisites

Before we begin, ensure that you have the following:

  • Ubuntu 18.04 installed on your system.
  • Barrier installed and configured correctly. If you haven’t already done this, you can follow the instructions on the official Barrier GitHub page.
  • Basic understanding of Linux terminal commands.

Creating a Systemd Service

The first step in setting up Barrier to run on startup is to create a systemd service. This is a script that the system will run automatically when it boots up.

Create a new systemd service file by typing the following command in the terminal:

sudo nano /etc/systemd/system/barrier.service

This command opens a new file called barrier.service in the nano text editor.

Copy and paste the following into the file:

[Unit]
Description=Barrier mouse/keyboard share
Requires=display-manager.service
After=display-manager.service
StartLimitIntervalSec=0

[Service]
Type=simple
ExecStart=/usr/bin/barrierc -f --enable-crypto <server-ip>
Restart=always
RestartSec=1
User=<your-username>

[Install]
WantedBy=multi-user.target

Let’s break down what each of these lines does:

  • Description: This is a brief description of the service.
  • Requires and After: These lines ensure that the display manager service is running before Barrier starts.
  • StartLimitIntervalSec=0: This line disables the start rate limiting.
  • Type=simple: This line indicates that the service is considered active once the process has been started.
  • ExecStart: This is the command that starts the service. In this case, it starts Barrier with the -f flag (which keeps it in the foreground), the --enable-crypto flag (which enables SSL), and the IP address of your Barrier server.
  • Restart=always and RestartSec=1: These lines ensure that the service will always restart after it stops, with a delay of 1 second.
  • User: This is the user that the service will run as. Replace <your-username> with your username.
  • WantedBy=multi-user.target: This line sets the service to start when the system has finished booting.

Save the file and exit the editor by pressing Ctrl+X, then Y to confirm, and finally Enter.

Enabling the Service

Now that the systemd service file is created, you need to reload the systemd configuration, enable the Barrier service, and start it. Run the following commands in the terminal:

sudo systemctl daemon-reload
sudo systemctl enable barrier.service
sudo systemctl start barrier.service

Setting Up SSL

If you’re using SSL, ensure that you have the necessary SSL certificates set up correctly. If you are using self-signed certificates, the program may not like them. Consider using Let’s Encrypt to create valid certificates. You can follow the instructions on the Let’s Encrypt website to do this.

Troubleshooting

If you encounter any issues, check the logs for error messages. You can use the journalctl command to view the logs for the Barrier service:

journalctl -u barrier.service

This command will display the logs for the Barrier service, which can help you troubleshoot any issues.

Conclusion

By following these steps, you should now have Barrier set up to run on startup with SSL in Ubuntu 18.04. This will allow you to share your mouse and keyboard between multiple computers securely and efficiently, without having to manually start Barrier each time you boot your system.

Can I use Barrier to share a mouse and keyboard between computers running different operating systems?

Yes, Barrier is compatible with multiple operating systems, including Linux, Windows, and macOS. You can share a mouse and keyboard between computers running different operating systems seamlessly.

Is it necessary to have SSL enabled for Barrier to run on startup?

No, SSL is not necessary for Barrier to run on startup. However, if you want to enable SSL for secure communication between the computers, you can follow the instructions provided in the article to set up SSL certificates.

Can I use Barrier to share a mouse and keyboard between more than two computers?

Yes, Barrier supports sharing a mouse and keyboard between multiple computers. You can set up Barrier to connect multiple clients to a single server, allowing you to control multiple computers with one mouse and keyboard.

Can I customize the systemd service file for Barrier?

Yes, you can customize the systemd service file for Barrier according to your needs. However, make sure to understand the syntax and functionality of systemd service files before making any modifications.

How can I uninstall Barrier from my Ubuntu 18.04 system?

To uninstall Barrier from your Ubuntu 18.04 system, you can use the following command in the terminal:

sudo apt remove barrier

This will remove Barrier and any associated files from your system.

Leave a Comment

Your email address will not be published. Required fields are marked *