# Syncing system directories (like /etc) when Syncthing runs as a user service?

**URL:** https://forum.syncthing.net/t/syncing-system-directories-like-etc-when-syncthing-runs-as-a-user-service/9252
**Category:** General
**Created:** [February 14, 2017, 2:50pm UTC](https://forum.syncthing.net/t/syncing-system-directories-like-etc-when-syncthing-runs-as-a-user-service/9252 "2017-02-14T14:50:18Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![pwd](https://forum.syncthing.net/user_avatar/forum.syncthing.net/pwd/32/3258_2.png) [@pwd](https://forum.syncthing.net/u/pwd)
#### Post date: [February 14, 2017, 2:50pm UTC](https://forum.syncthing.net/t/syncing-system-directories-like-etc-when-syncthing-runs-as-a-user-service/9252/1 "2017-02-14T14:50:19Z")

</div>

I’m curious how do you handle syncing `/etc` directory when Syncthing runs as a user service (`systemctl --user ...`)?

---

<div class="post-metadata">

### Author: ![firecat4153](https://forum.syncthing.net/user_avatar/forum.syncthing.net/firecat4153/32/92_2.png) [@firecat4153](https://forum.syncthing.net/u/firecat4153)
#### Post date: [February 14, 2017, 2:56pm UTC](https://forum.syncthing.net/t/syncing-system-directories-like-etc-when-syncthing-runs-as-a-user-service/9252/2 "2017-02-14T14:56:20Z")

</div>

You can’t 🙂 The process has to have permissions to act on the files it syncs. Not to mention, syncing system directories like /etc and /var is typically going to be a bad idea, as they often contain special file types (like socket files or symlinks) or database files. If you’re going for a backup system, there are a bunch of better suited tools then a one-way Syncthing instance.

Scott

Edit: I should clarify, that you can _read_ any file that the Syncthing user can read, likewise with writes. There are numerous files in /etc/ that are read-only for root, meaning those will not be synced, and none of the files would be able to be overwritten when syncing from another device.

---

<div class="post-metadata">

### Author: ![daftaupe](https://forum.syncthing.net/user_avatar/forum.syncthing.net/daftaupe/32/4272_2.png) [@daftaupe](https://forum.syncthing.net/u/daftaupe)
#### Post date: [February 14, 2017, 4:16pm UTC](https://forum.syncthing.net/t/syncing-system-directories-like-etc-when-syncthing-runs-as-a-user-service/9252/3 "2017-02-14T16:16:33Z")

</div>

@firecat4153, as I understand @pwd message, the goal is to sync /etc files to another host in order to back them up from there. In this particular point of view, it will never happen to have modifications on the remote /etc folder and it’s not the backup tool either, just a sync tool (as expected).

---

<div class="post-metadata">

### Author: ![pwd](https://forum.syncthing.net/user_avatar/forum.syncthing.net/pwd/32/3258_2.png) [@pwd](https://forum.syncthing.net/u/pwd)
#### Post date: [February 14, 2017, 4:33pm UTC](https://forum.syncthing.net/t/syncing-system-directories-like-etc-when-syncthing-runs-as-a-user-service/9252/4 "2017-02-14T16:33:21Z")

</div>

How about running extra instance of Syncthing as root for this? This leads to general question – is every user of given computer supposed to run his instance of Syncthing? I guess it would be nice if there would be only one instance of Syncthing handling data of different users. Let’s say each folder could be assigned to specific user.

---

<div class="post-metadata">

### Author: ![canton7](https://forum.syncthing.net/user_avatar/forum.syncthing.net/canton7/32/9528_2.png) [@canton7](https://forum.syncthing.net/u/canton7)
#### Post date: [February 14, 2017, 5:42pm UTC](https://forum.syncthing.net/t/syncing-system-directories-like-etc-when-syncthing-runs-as-a-user-service/9252/5 "2017-02-14T17:42:52Z")

</div>

Yes each user should run their own syncthing instance. That way each user can have their own configuration, you don’t risk users accidentally being given access to each others’ files through syncthing, etc.

With user services, the service is only started when the user logs on.

As others have said, if you’re looking to back up files, use a backup program.

---

<div class="post-metadata">

### Author: ![pwd](https://forum.syncthing.net/user_avatar/forum.syncthing.net/pwd/32/3258_2.png) [@pwd](https://forum.syncthing.net/u/pwd)
#### Post date: [February 15, 2017, 10:18am UTC](https://forum.syncthing.net/t/syncing-system-directories-like-etc-when-syncthing-runs-as-a-user-service/9252/6 "2017-02-15T10:18:47Z")

</div>

> [@canton7](#):
>
> Yes each user should run their own syncthing instance.

Should each instance use different device ID for local machine or can all share the same device ID?

---

<div class="post-metadata">

### Author: ![imsodin](https://forum.syncthing.net/user_avatar/forum.syncthing.net/imsodin/32/3317_2.png) [@imsodin](https://forum.syncthing.net/u/imsodin)
#### Post date: [February 15, 2017, 10:42am UTC](https://forum.syncthing.net/t/syncing-system-directories-like-etc-when-syncthing-runs-as-a-user-service/9252/7 "2017-02-15T10:42:24Z")

</div>

Same ID is a bad idea for sure, as both instances can run at the same time, in which case another Syncthing instance can’t discern the two. You need different IDs and ports for multiple instances on the same computer. Actually using “Device” is an unfortunate terminology in this context, but I can’t think of anything better (instance would be worse in other ways).

---

<div class="post-metadata">

### Author: ![canton7](https://forum.syncthing.net/user_avatar/forum.syncthing.net/canton7/32/9528_2.png) [@canton7](https://forum.syncthing.net/u/canton7)
#### Post date: [February 15, 2017, 11:53am UTC](https://forum.syncthing.net/t/syncing-system-directories-like-etc-when-syncthing-runs-as-a-user-service/9252/8 "2017-02-15T11:53:27Z")

</div>

Indeed, each instance will have its own configuration, which will be accessible **only** to the user who runs that instance of Syncthing.

Therefore each Syncthing instance will have its own Device ID, and different users can choose to share different files with different people.

---

<div class="post-metadata">

### Author: ![pwd](https://forum.syncthing.net/user_avatar/forum.syncthing.net/pwd/32/3258_2.png) [@pwd](https://forum.syncthing.net/u/pwd)
#### Post date: [February 15, 2017, 1:42pm UTC](https://forum.syncthing.net/t/syncing-system-directories-like-etc-when-syncthing-runs-as-a-user-service/9252/9 "2017-02-15T13:42:52Z")

</div>

Well, the question of how to setup ST for multiple users is actually a FAQ – [How do I configure multiple users on a single machine?](https://docs.syncthing.net/users/faq.html?highlight=overwritten#how-do-i-configure-multiple-users-on-a-single-machine). There we find the following warning:

> Be aware that you might need to configure listening ports such that they do not overlap

but there’s no information on different device ids…

---

<div class="post-metadata">

### Author: ![canton7](https://forum.syncthing.net/user_avatar/forum.syncthing.net/canton7/32/9528_2.png) [@canton7](https://forum.syncthing.net/u/canton7)
#### Post date: [February 15, 2017, 1:50pm UTC](https://forum.syncthing.net/t/syncing-system-directories-like-etc-when-syncthing-runs-as-a-user-service/9252/10 "2017-02-15T13:50:09Z")

</div>

You do not configure the Device ID yourself. If you have different Syncthing instances where each has its own config (which is the only sensible way to setup multiple Syncthing instances for multiple users), then each instance will get its own Device ID.

---

<div class="post-metadata">

### Author: ![pwd](https://forum.syncthing.net/user_avatar/forum.syncthing.net/pwd/32/3258_2.png) [@pwd](https://forum.syncthing.net/u/pwd)
#### Post date: [February 15, 2017, 2:02pm UTC](https://forum.syncthing.net/t/syncing-system-directories-like-etc-when-syncthing-runs-as-a-user-service/9252/11 "2017-02-15T14:02:02Z")

</div>

Well, I don’t know how but I got into situation in which I had the same device ID in two different configurations on one host (one normal user, one root). I stopped ST system service (which is syncthing@root so configuration is stored in /root/.config/syncthing), deleted /root/.config/syncthing and started service again. This resulted in new device ID so all is well now.

Btw, if anyone needs to manage ST systemd root’s user service then the way to do this is `sudo XDG_RUNTIME_DIR="/run/user/0" systemctl --user stop|start|status syncthing`. Information obtained from @grawity on #systemd channel. Not setting XDG\_RUNTIME\_DIR results in _Failed to connect to bus: No such file or directory_

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [February 15, 2017, 2:03pm UTC](https://forum.syncthing.net/t/syncing-system-directories-like-etc-when-syncthing-runs-as-a-user-service/9252/12 "2017-02-15T14:03:48Z")

</div>

The device ID is the hash of the public key, which is `cert.pem` in the config directory. If you clone the config directory, you clone the device ID. This is always a bad idea. 🙂

---

<div class="post-metadata">

### Author: ![pwd](https://forum.syncthing.net/user_avatar/forum.syncthing.net/pwd/32/3258_2.png) [@pwd](https://forum.syncthing.net/u/pwd)
#### Post date: [February 15, 2017, 2:08pm UTC](https://forum.syncthing.net/t/syncing-system-directories-like-etc-when-syncthing-runs-as-a-user-service/9252/13 "2017-02-15T14:08:02Z")

</div>

Sure. I just don’t remember cloning configuration but with my bad memory I never know… 🙂

---

<div class="post-metadata">

### Author: ![imsodin](https://forum.syncthing.net/user_avatar/forum.syncthing.net/imsodin/32/3317_2.png) [@imsodin](https://forum.syncthing.net/u/imsodin)
#### Post date: [February 15, 2017, 2:18pm UTC](https://forum.syncthing.net/t/syncing-system-directories-like-etc-when-syncthing-runs-as-a-user-service/9252/14 "2017-02-15T14:18:07Z")

</div>

Out of curiosity: Why do you start the root Syncthing instance as a systemd (root) user service and not as a system service?

---

<div class="post-metadata">

### Author: ![pwd](https://forum.syncthing.net/user_avatar/forum.syncthing.net/pwd/32/3258_2.png) [@pwd](https://forum.syncthing.net/u/pwd)
#### Post date: [February 15, 2017, 2:48pm UTC](https://forum.syncthing.net/t/syncing-system-directories-like-etc-when-syncthing-runs-as-a-user-service/9252/15 "2017-02-15T14:48:21Z")

</div>

Well, again I don’t know why but it got installed as a root’s user service 🙂 But yes, it does not make much sense so I disabled it and installed system service instead.
