How to share mouse and keyboard on Linux with barrier

Endrit Qerreti

Endrit Qerreti

In this tutorial, you will learn how to install and use barrier on Ubuntu 22.04.

barrier is an app that allows you to share your mouse and keyboard to multiple computers at the same time, which means you can control multiple computers by using the same mouse and keyboard.

barrier works over internet, which means you don't need to do any setup other than normal internet connection, so all you have to do is make sure both computers where you are planning to use the same mouse or keyboard have access to internet.

barrier can be installed on any Linux distro.

In Ubuntu, barrier is available on the Universe repository, so you can easily install barrier via the terminal.

Step 1 - Update your system

Before installing barrier, proceed to update your package index on your Ubuntu machine, and also any old package that you may have.

sudo apt update

Step 2 - Install barrier

The package barrier can be found on Universe repository of Ubuntu 22.04, which means installing barrier is very easy, and it can be done directly from any terminal that you have on your machine.

Let's say you are planning to control two computers using same keyboard and mouse, to be able to do this, you need to install barrier on both machines.

To install barrier, simply run the command below.

sudo apt install barrier

Step 3 - Configure barrier

Once you have installed barrier on both computers, now you need to proceed configuring barrier, meaning you need to choose which computer is the server and which is the client.

Server - allows you to share mouse and keyboard of the server

Client - allows you to control the client's machine via same mouse and keyboard shared from server.

Let's say you have two computers A and B, computer A is server, and computer B is client.

Computer A - can share mouse and keyboard.

Computer B - in this computer you can use the computer's A mouse and keyboard.

Now launch barrier by going into applications menu, and search for "barrier", and click its icon to launch it.

Once you launch barrier, you will see the welcome window, as shown below. In this window, you need to click Next to proceed configuring barrier as server or client.

Configure barrier Server

To use barrier as server select "Server" option as shown in the screenshot below.

Next, you need to configure your server, and the layout that you'll be using. To do this, simply click "Configure server" button.

And configure your layout. To add another computer, drag the computer icon at the top right and add it on grid, and click OK to save changes.

For example, in this config we have two computers added on the grid, where ubuntu-22-04 is the server, and Debian-12 is the client.

Configure barrier Client

To use barrier as client, go with "Client" option.

Next, you can set the IP of the server manually, or leave this option as is.

Step 4 - Use barrier

Now that you have configured barrier on both machines, you should be able to use the same mouse and keyboard on both machines.

Conclusion

In this tutorial, you learned how to use one single mouse and keyboard to control multiple computers at the same time with barrier.