Barrier is a free popular KVM software that enables mouse/keyboard sharing across several devices.

I've been fiddling with it for a few hours and I can't seem to get it right.

I have a barrier server running on my Windows machine. I've downloaded the git repository and built the binaries. I've copied barrier, barrierc and barriers into /usr/bin.

If I run barrier GUI, specify the server IP and enable the server, it works. I can do it with and without SSL (as long as both the client and the server have the same setting set). I would prefer to use SSL though.

I've then tried running barrierc --enable-crypto <ip>. The server acknowledges the connection, but says it's not secure and it doesn't work. However, if I run the same command with the -f flag barrierc -f --enable-crypto <ip> which makes it run in the foreground, it all works dandy.

Since I'm on Ubuntu 18.04, I've setup a systemd service like so:

Description=Barrier mouse/keyboard share

ExecStart=/usr/bin/barrierc -f --enable-crypto


I've named it barrier.service and copied it into /etc/systemd/system/.

I've tried starting it manually, but it refuses to work. From what I can tell from systemctl status, it looks like systemd runs the client, but the client exits immediately and then it restarts it. I've tried with and without the -f flag, but the result is the same.

The server also complains that the client connection might not be secure, which is the same error you get when you try to connect with a non SSL client to an SSL server. It does so with and without the -f flag.

I know I have to enable the service to have it run on startup, but how do I get it to work at all?

  • Could be that the program does not like self-signed certificates. Maybe you try to create a certificate with let's encrypt?
    – s1mmel
    Jan 9, 2020 at 13:58
  • The program works fine if I run it directly from the terminal, in foreground, but throws a fit if I run it in the background or if I try to run it as a service. Since it does work, I doubt that certificates are the problem. Jan 9, 2020 at 14:04
  • Try to start it with nohup and take a look into the logs.
    – s1mmel
    Jan 9, 2020 at 14:38
  • I got no useful info from it. Jan 11, 2020 at 0:02
  • @Karlovsky120 have you solved this problem with barrier?
    – ttfreeman
    Apr 27, 2020 at 16:49

8 Answers 8


I got it working for me on Ubuntu 20.04, but the steps probably will not be different on 18.04

You might want to undo your barrier.service first then do the following

  1. Get a working setup using keyboard and mouse at your client Ubuntu, note down [name of your client/screen]
  2. Open terminal and get the full cli commands equivalent of current working setup without using configure file i.e. run "ps aux | grep barrier"
user@hp-eo800-g1-aio-u:~$ ps aux | grep barrier
user        1278  0.0  0.1  98896 10256 ?        Sl   Nov16   0:29 /usr/bin/barrierc -f --no-tray --debug INFO --name [name of your client/screen] --enable-crypto --log /var/log/barrier.log [SERVER IP ADDRESS]:24800
user       14737  0.0  0.0   9036   668 pts/0    S+   09:41   0:00 grep --color=auto barrier
  1. Notice the last part of ps output, that'd the full command with all parameters you need run your Ubuntu as a client, copy it
/usr/bin/barrierc -f --no-tray --debug INFO --name [name of your client/screen] --enable-crypto --log /var/log/barrier.log [SERVER IP ADDRESS]:24800
  1. Create a new entry in the Startup Applications Preferences New entry in Startup Applications Preferences and paste the command to Command section as seen in attached screen cap
  2. Reboot now to test that it will auto kick off as your Desktop manager is brought up.

I was able to do this more simply I think on a Raspberry Pi 4 running Ubuntu 20.04 with barrier version 2.3.3:

  1. Edit ~/.config/Debauchee/Barrier.conf
  2. Set the autoHide value:

Then you can just add /usr/bin/barrier (not barrierc) without any arguments into Startup Application preferences.


I tested , and i was able to start barrier .

barrier is failing try to read STDIN , by default STDIN is map to /dev/null

So you need to start barrier with a STDIN map to a file with data

ExecStart=/bin/bash -c 'exec /usr/bin/barrierc -f --enable-crypto </dev/zero' 
  • What data would you put in /dev/zero? Barrier doesn't need any input from STDIN. Jun 1, 2020 at 23:21
  • /dev/zero is a char device , you can read read and it contains only a infinite value of zero . the device is already here . ls -la /dev/zero Jun 2, 2020 at 4:08
  • @JasonKelley , i did not dig into the code but barrier ( or ldependencies ) read and one moment STDIN . But i found it by running strace Jun 2, 2020 at 4:12
  • you can prove by running manually , that barrier will fail if you run /usr/bin/barrierc -f --enable-crypto </dev/null Jun 2, 2020 at 4:13

What worked for me was to use the Startup Applications Preferences, but did it a bit differently than the above.

  1. Ran the following:

    # ps aux | grep barrier
    user       1385  1.0  0.0  98884  9288 ?        Sl   21:34   0:01 **/usr/bin/barrierc -f --name <name of screen here> --enable-crypto --log /var/log/barrier.log []:24800**
    root        2727  0.0  0.0   9032   724 pts/0    S+   21:37   0:00 grep --color=auto barrier
  2. Opened Startup Applications Preferences, but in my case I just had to browse to the location of "barrierc" and select the correct file. NOTE: The copy and paste didn't work for some reason.

  3. I added the rest and reloaded barrier before computer restart.

  4. Rebooted and it worked.


I installed Barrier as an Ubuntu Snap, as such it's not in /usr/bin/barrier. The PS AUX trick above doesn't work because it references a path that doesn't exist either. I assume some snap related thing.

My path was /snap/bin/barrier.barrierc (for client, barriers for server)

Adjusting the path to that and then keeping all the other CLI options, and putting that in Startup, worked great.


For those needing to be able to log in, I found a work around to running a service. Not sure if it is any more or less secure. For LightDM on Xubuntu (I imagine others have similar options) open Settings > LightDM GTK+ Greeter Settings > Misc. tab

Under accessibility > keyboard Change the prefilled command to

barrierc --no-daemon --name <computer name> --enable-crypto --debug INFO <ip address>

Set to Enabled at start

In Settings > Sessions and Startup > Applications Autostart tab Add barrier

This works perfectly as the lightdb instance stops once login is complete and the desktop instance stops when you log out so there is no conflict.

The only possible issue is if you need the onscreen keyboard in lightdm


A few caveats

I re-imaged my Pi and realized there are a few things that needed to be in place for this to work.

  1. You have to have the LightDM GTK+ Greeter Settings installed, it may not be by default.

sudo apt install lightdm-gtk-greeter-settings

  1. The first run of Barrier on the log in screen has to be the GUI.

Under accessibility > keyboard, instead of the command string use only the command "barrier", log out, wait for the barrier gui to appear.

Log back in and change the setting to the command string in the original post.

  1. If you are doing this on Raspberry Pi OS, you have to change the greeter session.

Raspberry Pi OS by default uses pi-greeter, you need to change this to lightdm-gtk-greeter

This has to be done as root/su, I used sudo mousepad to open mousepad with elivated privileges to open and edit the file.

In etc\lightdm edit the lightdm.conf, on my system it is at line # 108

Change greeter-session=pi-greeter To greeter-session=lightdm-gtk-greeter


Even though its' kinda old thread, when looking for a quick and easy solution unfortunately i didn't find any working systemd service file. So here's mine:

We just have to tell systemd to start the as the user you would normally run the client.


Description=Start Barrier Client

ExecStart=/usr/bin/barrierc -f --no-tray --debug INFO --name <clientname> --enable-crypto [<serverip>]:<serverport>



Description=Start Barrier Server

ExecStart=/usr/bin/barriers -f --no-tray --debug INFO --name <servername> --enable-crypto -c <path-to-config> --address :24800


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.