# Error trying to use zrok for remote desktop

**URL:** <https://openziti.discourse.group/t/error-trying-to-use-zrok-for-remote-desktop/2975>\
**Category:** zrok\
**Created:** [August 14, 2024, 11:41am UTC](https://openziti.discourse.group/t/error-trying-to-use-zrok-for-remote-desktop/2975 "2024-08-14T11:41:14Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![firn](https://avatars.discourse-cdn.com/v4/letter/f/ea5d25/32.png) [@firn](https://openziti.discourse.group/u/firn)\
**Post date:** [August 14, 2024, 2:49pm UTC](https://openziti.discourse.group/t/error-trying-to-use-zrok-for-remote-desktop/2975/21 "2024-08-14T14:49:41Z")

</div>

By logging out you mean actually going to power settings log out?  
Because this also stops the zroc share for me and all other processes running.

---

<div class="post-metadata">

**Author:** ![TheLumberjack](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/thelumberjack/32/113_2.png) [@TheLumberjack](https://openziti.discourse.group/u/TheLumberjack)\
**Post date:** [August 14, 2024, 3:09pm UTC](https://openziti.discourse.group/t/error-trying-to-use-zrok-for-remote-desktop/2975/22 "2024-08-14T15:09:21Z")

</div>

Ah. Yes that's what I mean and yes that is important. You want to run zrok as a service or somehow disconnect the terminal from the session so you _can_ logout.

You can check out zrok front door here: [zrok frontdoor | Zrok](https://docs.zrok.io/docs/guides/frontdoor/?os=Linux). You could go search the internet for other ways to do it. You could write your own systemd service, you could use nohup, whatever you decide works best for you.

---

<div class="post-metadata">

**Author:** ![firn](https://avatars.discourse-cdn.com/v4/letter/f/ea5d25/32.png) [@firn](https://openziti.discourse.group/u/firn)\
**Post date:** [August 19, 2024, 1:13pm UTC](https://openziti.discourse.group/t/error-trying-to-use-zrok-for-remote-desktop/2975/23 "2024-08-19T13:13:46Z")

</div>

I cant find a way to log out without killing the process, how did you do that?

---

<div class="post-metadata">

**Author:** ![TheLumberjack](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/thelumberjack/32/113_2.png) [@TheLumberjack](https://openziti.discourse.group/u/TheLumberjack)\
**Post date:** [August 19, 2024, 1:27pm UTC](https://openziti.discourse.group/t/error-trying-to-use-zrok-for-remote-desktop/2975/24 "2024-08-19T13:27:30Z")

</div>

You can either start it as a systemd service:

- [https://linuxhandbook.com/create-systemd-services/](https://linuxhandbook.com/create-systemd-services/)

You can use zrok front door (which will end up making a sysetmd service):

- [zrok frontdoor | Zrok](https://docs.zrok.io/docs/guides/frontdoor/?os=Linux)

You can run "nohup" and put the process into the background:

- [How to Use Linux nohup Command {With Examples}](https://phoenixnap.com/kb/linux-nohup)

It's not as "elegant" as the other two but for some it's easier to understand and manage. This for example will keep your zrok test endpoint running until the box restarts. (that's why learning systemd is probably worth it as systemd will restart it for you)...

```auto
nohup zrok test endpoint --port 8449 --address 0.0.0.0 &

```

---

<div class="post-metadata">

**Author:** ![firn](https://avatars.discourse-cdn.com/v4/letter/f/ea5d25/32.png) [@firn](https://openziti.discourse.group/u/firn)\
**Post date:** [August 19, 2024, 1:46pm UTC](https://openziti.discourse.group/t/error-trying-to-use-zrok-for-remote-desktop/2975/25 "2024-08-19T13:46:08Z")

</div>

I tried both of these but zrok just doesnt want to start sadly.  
this is my service:  
GNU nano 6.2 /etc/systemd/system/start-on-boot.service M  
[Unit]  
Description= trying

[Service]  
ExecStart=/home/firn/logouttest.sh  
Type=simple

[Install]  
WantedBy=multi-user.target

this is my the script:  
#!/bin/bash

zrok share private --backend-mode tcpTunnel 127.0.0.1:3389

sorry, for the question, i know this isnt exactly zrok related.

---

<div class="post-metadata">

**Author:** ![TheLumberjack](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/thelumberjack/32/113_2.png) [@TheLumberjack](https://openziti.discourse.group/u/TheLumberjack)\
**Post date:** [August 19, 2024, 2:34pm UTC](https://openziti.discourse.group/t/error-trying-to-use-zrok-for-remote-desktop/2975/26 "2024-08-19T14:34:25Z")

</div>

first thing i would do is reserve a share. this way your 'access' is always the same making accessing it muchmuch easier:

```auto
zrok reserve private --backend-mode tcpTunnel 127.0.0.1:3389 --unique-name cdtestrdp

```

After that update your script to start that reserved share. you can see I used `/home/cd/start-zrok-rdp.sh`. You must pass `--headless` as well and use the proper shebang (which you have)

```auto
cat /home/cd/start-zrok-rdp.sh

#!/bin/sh
/home/cd/bin/zrok share reserved cdtestrdp --headless

```

You also need to make sure it's executable:

```auto
sudo chmod +x /home/cd/start-zrok-rdp.sh

```

Make/edit the `zrok-rdp`service:

```auto
sudo vi /etc/systemd/system/zrok-rdp.service

```

Use this content:

```auto
[Unit]
Description=Start zrok share to share RDP
After=network.target

[Service]
ExecStart=/home/cd/start-zrok-rdp.sh
Type=notify
Restart=always
Environment=HOME=/home/cd

[Install]
WantedBy=default.target
RequiredBy=network.target

```

Reload systemd and enable zrok rdp and verify status:

```auto
sudo systemctl daemon-reload
sudo systemctl enable zrok-rdp
sudo systemctl status zrok-rdp

```

Use journalctl to see the logs:

```auto
sudo journalctl -fu zrok-rdp

```

Hopefully that helps...

---

<div class="post-metadata">

**Author:** ![qrkourier](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/qrkourier/32/52_2.png) [@qrkourier](https://openziti.discourse.group/u/qrkourier)\
**Post date:** [August 19, 2024, 2:37pm UTC](https://openziti.discourse.group/t/error-trying-to-use-zrok-for-remote-desktop/2975/27 "2024-08-19T14:37:37Z")

</div>

Security tip: Add `--closed` to your zrok command to ensure that only your own zrok account can access the private share.

```bash
zrok reserve private --closed --backend-mode tcpTunnel 127.0.0.1:3389 --unique-name cdtestrdp

```

[Previous page](https://openziti.discourse.group/t/error-trying-to-use-zrok-for-remote-desktop/2975.md?page=1)
