diff --git a/README.md b/README.md index fd65e952..d1d5823f 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,6 @@ The following steps will configure your Windows 10 machine for building the Remo * Windows: Only the latest version of Windows 10 is tested. * Linux: Only Lubuntu 18.10 is tested. * Your account must be set to auto login for unattended remote control to work. - * The install script needs to be run while the above account is logged in. ## Session Recording * You can turn on session recording in appsettings.json. diff --git a/Remotely_Agent/Services/DeviceSocket.cs b/Remotely_Agent/Services/DeviceSocket.cs index 3c056d3e..d2270c2c 100644 --- a/Remotely_Agent/Services/DeviceSocket.cs +++ b/Remotely_Agent/Services/DeviceSocket.cs @@ -272,7 +272,14 @@ namespace Remotely_Agent.Services { var users = OSUtils.StartProcessWithResults("users", ""); var username = users?.Split()?.FirstOrDefault()?.Trim(); - var casterProc = Process.Start("sudo", $"-u {username} {rcBinaryPath} -mode Unattended -requester {requesterID} -serviceid {serviceID} -host {Utilities.GetConnectionInfo().Host} -desktop default & disown"); + var psi = new ProcessStartInfo() + { + FileName = "sudo", + Arguments = $"-u {username} {rcBinaryPath} -mode Unattended -requester {requesterID} -serviceid {serviceID} -host {Utilities.GetConnectionInfo().Host} -desktop default & disown" + }; + psi.Environment.Add("DISPLAY", ":0"); + psi.Environment.Add("XAUTHORITY", $"/home/{username}/.Xauthority"); + var casterProc = Process.Start(psi); casterProc.WaitForExit(); } } @@ -317,8 +324,14 @@ namespace Remotely_Agent.Services { var users = OSUtils.StartProcessWithResults("users", ""); var username = users?.Split()?.FirstOrDefault()?.Trim(); - - var casterProc = Process.Start("sudo", $"-u {username} {rcBinaryPath} -mode Unattended -requester {requesterID} -serviceid {serviceID} -host {Utilities.GetConnectionInfo().Host} -relaunch true -desktop default -viewers {String.Join(",", viewerIDs)} & disown"); + var psi = new ProcessStartInfo() + { + FileName = "sudo", + Arguments = $"-u {username} {rcBinaryPath} -mode Unattended -requester {requesterID} -serviceid {serviceID} -host {Utilities.GetConnectionInfo().Host} -relaunch true -desktop default -viewers {String.Join(",", viewerIDs)} & disown" + }; + psi.Environment.Add("DISPLAY", ":0"); + psi.Environment.Add("XAUTHORITY", $"/home/{username}/.Xauthority"); + var casterProc = Process.Start(psi); casterProc.WaitForExit(); } } diff --git a/Remotely_Server/CurrentVersion.txt b/Remotely_Server/CurrentVersion.txt index f379b4a8..524f4006 100644 --- a/Remotely_Server/CurrentVersion.txt +++ b/Remotely_Server/CurrentVersion.txt @@ -1 +1 @@ -2019.04.06.1318 +2019.04.08.0720 diff --git a/Remotely_Server/wwwroot/Downloads/Install-Linux-x64.sh b/Remotely_Server/wwwroot/Downloads/Install-Linux-x64.sh index 6ec3f25d..301a7ea1 100644 --- a/Remotely_Server/wwwroot/Downloads/Install-Linux-x64.sh +++ b/Remotely_Server/wwwroot/Downloads/Install-Linux-x64.sh @@ -43,9 +43,6 @@ EOL echo Creating service... -usersArr=($(users)) -targetUser=${usersArr[0]} - cat > /etc/systemd/system/remotely-agent.service << EOL [Unit] Description=The Remotely agent used for remote access. @@ -54,9 +51,7 @@ Description=The Remotely agent used for remote access. WorkingDirectory=/usr/local/bin/Remotely/ ExecStart=/usr/local/bin/Remotely/Remotely_Agent Restart=always -RestartSec=10 -Environment=DISPLAY=:0 -Environment="XAUTHORITY=/home/$targetUser/.Xauthority" +RestartSec=10" [Install] WantedBy=graphical.target