Server: Windows 7
Client: Ubuntu 16.04
barrierc 2.2.0-Release
In Ubuntu,
How to auto start before login ?
I think I can use systemd but that's not easy (I am beginner.)
I did like below
# vi /lib/systemd/system/barrier.service
[Unit]
Description=Barrier for sharing mouse and keyboard
After=network.target graphical-session.target
[Service]
ExecStart=/usr/bin/barrierc -f --debug INFO --name resisa-4 --enable-crypto [10.251.156.87]:24800
Restart=always
SyslogLevel=err
[Install]
WantedBy=multi-user.target
# systemctl daemon-reload
# systemctl enable barrier
# reboot
and then there's a problem.
# systemctl status barrier
\u25cf barrier.service - Barrier for sharing mouse and keyboard
Loaded: loaded (/lib/systemd/system/barrier.service; enabled; vendor preset: enabled)
Active: active (running) since \uc218 2018-11-21 20:43:28 KST; 23s ago
Main PID: 1610 (barrierc)
Tasks: 3
Memory: 1.5M
CPU: 9ms
CGroup: /system.slice/barrier.service
\u2514\u25001610 /usr/bin/barrierc -f --debug INFO --name resisa-4 --enable-crypto [10.251.156.87]:24800
11\uc6d4 21 20:43:28 resisa-4 systemd[1]: Started Barrier for sharing mouse and keyboard.
11\uc6d4 21 20:43:28 resisa-4 barrierc[1610]: No protocol specified
11\uc6d4 21 20:43:28 resisa-4 barrierc[1610]: [2018-11-21T20:43:28] WARNING: secondary screen unavailable: unable to open screen
That's a dangerous service file, as barrier is being ran as root. As how to run it before login, I can't think of a way at the moment. Also, user created unit files go in /etc/systemd/system/.
I find https://help.ubuntu.com/community/SynergyHowto#Autostart_Synergy_before_logging_in_.28LightDM.29
link for synergy.
Like this, I tried but failed.
Let's think about user has one windows PC and one ubuntu PC and one mouse and keyboard.
If reboot ubuntu, how can I login ubuntu ?
If autostart before login does not work, user should have to connect mouse and keyboard to ubuntu PC.
I find help.ubuntu.com/community/SynergyHowto#Autostart_Synergy_before_logging_in_.28LightDM.29 link for synergy.
Beware, this would also run synergy/barrier as root.
Let's think about user has one windows PC and one ubuntu PC and one mouse and keyboard.
If reboot ubuntu, how can I login ubuntu ?
If autostart before login does not work, user should have to connect mouse and keyboard to ubuntu PC.
One thing that comes to mind is having the ubuntu machine auto-login (if you're comfortable with that).
@Hokwang, I wonder if you have succeeded.
I am able to start barrierc on boot (the computer logs in automatically), and it runs in the background, but the mouse icon is invisible. The mouse icon only becomes visible once I physically plug/unplug the mouse on this computer. This defeats the whole purpose of "booting the computer and having mouse/keyboard without ever physically plugging them in"
I believe this is more of a Linux problem than "barrier" problem, but I wasn't able to find a solution to this...
I'm wondering if this was figured out as well. I have been using login screen via VNC connection for now but would be nice to not have to load that every time I log out of my second machine (ubuntu).
@noisyshape is the "ideal world" scenario possible鈥攖hat Barrier can start soon enough to allow for password entry on the Ubuntu machine that doesn't have KB/mouse plugged in? I can't have this machine log in automatically in an office environment for security/privacy reasons.
@evictor Very important question: If barrier is running before you log in (so that you can log in), what user is barrier running under?
If autologin is considered unsafe, then running barrier as root is definitely unsafe. Perhaps you can make some kind of limited user just for barrier, but I'm not sure how that would work or if it's feasible.
If you're using a systemd unit file for the service, you might be able to use DyanmicUser=yes, which would generate a unprivileged user every time the service starts to run the service under.
Personally, I have solved this issue by making ubuntu login without asking for password, then make barrier start automatically and then lock the screen using gnome-screensaver-command -l
As for my comment above on the invisible mouse, I fixed it with gsettings set org-gnome.settings-daemon.plugins.cursor active false
Thx all for the very good input re: login user.
Another somewhat related concern for always-on Barrier client鈥攚hat is stopping a malicious party with access to the network from pretending to be the server and then gaining control of the client? For instance, I connect to the server via static hostname, but if the server is offline someone can just pose w/ that hostname and instantly get control of the client.
I don't see any built-in features to handle authentication but that would be excellent if a handshake of some sort could happen (esp. key-based auth) on connect. Or maybe just a warning + refusal to connect if the SSL fingerprint has changed. In that scenario it is reasonable to me to require direct keyboard/mouse on the remote machine to authorize the connection.
For reference we are using Barrier for an always-on big screen monitoring dash.
I do not have a lot of knowledge about any of this, but I know that there is a fingerprint detection that takes place for the client to recognize the server. I have to accept the fingerprint the first time I run the client on a new computer.
Servers can be authenticated with a fingerprint. The GUI program is supposed to kill the client when there's an unapproved fingerprint. Unless I'm mistaken, the client itself doesn't handle fingerprints and if you're running the client by itself you may silently connect to an unauthenticated server.
Note this works for me on raspbian (assuming you want to control the Pi with another machine):
pi@raspberrypi:~ $ cat /etc/systemd/system/barrier.service
[Unit]
Description=Barrier mouse/keyboard share
Requires=display-manager.service
After=display-manager.service
StartLimitIntervalSec=0
[Service]
Type=forking
ExecStart=/usr/bin/barrierc --no-restart --name raspberrypi 192.168.10.12
Restart=always
RestartSec=10
User=pi
[Install]
WantedBy=multi-user.target
in case someone comes back here:
what worked for me was to follow what marcelinomalmeidan did:
set up auto-login in /etc/gdm3/custom.conf
and then gsettings set org.gnome.settings-daemon.plugins.cursor active false
I found out this,
$ sudo vi /etc/lightdm/lightdm.conf
[SeatDefaults]
autologin-user=
greeter-setup-script=/usr/bin/barrierc --debug INFO --name <Ubuntu PC hostname> <Windows PC IP>:24800
and reboot.
So I close this.
lightdm has changed config file format, newer versions need:
```
[Seat:*]
.
.
.
````
But more things seem to have changed and somehow my setup does not reliably work anymore... (Like a 1 minute delay to connect back to the server)
This is certainly on my network though.
Most helpful comment
Personally, I have solved this issue by making ubuntu login without asking for password, then make barrier start automatically and then lock the screen using gnome-screensaver-command -l