Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to auto start before login at Ubuntu 16.04 #179

Closed
Hokwang opened this issue Nov 21, 2018 · 18 comments
Closed

how to auto start before login at Ubuntu 16.04 #179

Hokwang opened this issue Nov 21, 2018 · 18 comments
Labels
duplicate This issue or pull request already exists linux Related to Linux

Comments

@Hokwang
Copy link

Hokwang commented Nov 21, 2018

Operating Systems

Server: Windows 7

Client: Ubuntu 16.04

Barrier Version

barrierc --version

barrierc 2.2.0-Release

Steps to reproduce bug

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
@AdrianKoshka
Copy link

AdrianKoshka commented Nov 21, 2018

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/.

@Hokwang
Copy link
Author

Hokwang commented Nov 22, 2018

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.

@AdrianKoshka
Copy link

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).

@marcelinomalmeidan
Copy link

marcelinomalmeidan commented Feb 1, 2019

@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...

@carlgrosser
Copy link

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).

@evictor
Copy link

evictor commented May 3, 2019

@noisyshape is the "ideal world" scenario possible—that 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.

@hovissimo
Copy link

@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.

@AdrianKoshka
Copy link

AdrianKoshka commented Jun 14, 2019

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.

@marcelinomalmeidan
Copy link

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

@marcelinomalmeidan
Copy link

As for my comment above on the invisible mouse, I fixed it with gsettings set org-gnome.settings-daemon.plugins.cursor active false

@evictor
Copy link

evictor commented Jun 17, 2019

Thx all for the very good input re: login user.

Another somewhat related concern for always-on Barrier client—what 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.

@marcelinomalmeidan
Copy link

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.

@noisyshape
Copy link

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.

@yonderblue
Copy link

yonderblue commented Jul 11, 2019

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

@shymega shymega added duplicate This issue or pull request already exists linux Related to Linux labels Aug 20, 2019
@ghost
Copy link

ghost commented Jun 17, 2020

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

@Hokwang
Copy link
Author

Hokwang commented Jun 18, 2020

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.

@Hokwang Hokwang closed this as completed Jun 18, 2020
@SteveClement
Copy link

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.

@twnaing
Copy link

twnaing commented Nov 21, 2021

ArchLinux aur has slim-synergy package. I think someone could easily replace synergy with barrier easily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists linux Related to Linux
Projects
None yet
Development

No branches or pull requests