How to start the teamviewer service before login?

Suppose that there are two pc :pc-A and pc-B,both of them installed teamviewer(version 15.13.6).
First i boot pc-A,pc-B,no name and password inputted in pc-A,instead name and password inputted in pc-B,i login pc-B,the below is a screenshot for pc-A.
How to start the teamviewer service before login?

At this time , i can’t input name and password in pc-A from pc-B via teamviewer,because that teamviewer service have not started in pc-A.

I want to set teamviewer service started before login pc-A.
Here is my try:

sudo vim /etc/systemd/system/remote-desktop.service    
[Unit]    
Description=remote-desktop
After=network.target
    
[Service]
Type=oneshot
ExecStart=/opt/teamviewer/tv_bin/script/teamviewer
KillMode=process

    
[Install]
WantedBy=multi-user.target

sudo systemctl reload remote-desktop.service
sudo systemctl enable remote-desktop.service

The remote-desktop.service can’t be started at boot time until login.

● remote-desktop.service - remote-desktop
   Loaded: loaded (/etc/systemd/system/remote-desktop.service; enabled; vendor preset: enabled)
   Active: failed (Result: signal) since Sat 2021-01-23 16:33:58 CST; 3min 3s ago
  Process: 871 ExecStart=/opt/teamviewer/tv_bin/script/teamviewer (code=killed, signal=ABRT)
 Main PID: 871 (code=killed, signal=ABRT)
      CPU: 922ms

Jan 23 16:33:33  systemd[1]: Started remote-desktop.
Jan 23 16:33:36  teamviewer[871]: Init...
Jan 23 16:33:37  teamviewer[871]: xprop:  unable to open display ''
Jan 23 16:33:37  teamviewer[871]: CheckCPU: SSE2 support: yes
Jan 23 16:33:37  teamviewer[871]: Checking setup...
Jan 23 16:33:37  teamviewer[871]: Launching TeamViewer ...
Jan 23 16:33:37  teamviewer[871]: Launching TeamViewer GUI ...
Jan 23 16:33:58  systemd[1]: remote-desktop.service: Main process exited, code=killed, status=6/ABRT
Jan 23 16:33:58  systemd[1]: remote-desktop.service: Unit entered failed state.
Jan 23 16:33:58  systemd[1]: remote-desktop.service: Failed with result 'signal'.

Reboot pc-A and test, the name and password still can’t input from pc-B via teamviewer.
And it is no use to set something in teamviewer’s option.
How to start the teamviewer service before login?

My teamvierwer is the free version,there is no option such as Full access control when a partner is connecting to the Windows logon screen in my version,maybe you can introduce some other free remote control software (important:pay no money ) which can start before logoning the login screen .I accept it as a solution too when you have done,give the 500 bounty point.
Sum up:after remotely waking my pc,how can input account name and passwrod remotely,i can’t do it with teamviewer.

How to fix it?

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

After trying and investigating the situation you have described in your post, the issue seems to be that this version of TeamViewer is unable to start an X server session which is needed for TeamViewer to work.

So you can enable automatic login on pc-A and it will work. Have a look at Automated login and screen lock If you need privacy and want the screen locked.

However, you do need to enable Start TeamViewer with system and set Personal Password under options in TeamViewer on pc-A then reboot first for that to work.


An alternative solution to remotely login and start X server session for TeamViewer to work is to install xrdp on pc-A like so:

sudo apt install xrdp

Then, make sure the xrdp service is enabled and started ( it usually is ).

After that from pc-B run remmina like so:

remmina

Then, enter the pc-A’s IP in the remmina GUI and press Enter

remmina is most likely already installed on your system but if you need, install it like so:

sudo apt install remmina

Notice:

You can connect to xrdp by IP / Host-name only and if the two PCs are not on the same local network, you might find free dynamic DNS services like no-ip and others helpful.

Solution 2

Teamviewer automatically created this for me, /etc/systemd/system/teamviewerd.service.

It looks a little bit different than yours.
And it works for me.

[Unit]
Description = TeamViewer remote control daemon
After = network.target network-online.target dbus.service
Wants = network-online.target
Requires = dbus.service

[Service]
Type = forking
PIDFile = /var/run/teamviewerd.pid
ExecStart = /opt/teamviewer/tv_bin/teamviewerd -d
Restart = on-abort
StartLimitInterval = 60
StartLimitBurst = 10

[Install]
WantedBy = multi-user.target

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply