# System Management

##### Users and Groups

```shell
# Add user
# for Debian
adduser -d /qortal_home -s /bin/bash -c "Qortal Node" qortal
# for Ubuntu
addgroup qortal
adduser --home /qortal_home --ingroup qortal --shell /bin/bash --gecos "Qortal Node" qortal
adduser --gecos "Bastillion-Jetty" jetty
## for System only
adduser --system  --gecos "Bastillion-Jetty" --group jetty  

# Delete user
deluser --remove-home jetty
# Delete group
delgroup jetty
```

##### Network

/etc/network/interfaces:

```
auto eth0
iface eth0 inet static
address 10.1.1.201
netmask 255.255.255.0
network 10.1.1.0
broadcast 10.1.1.255
gateway 10.1.1.254
dns-nameservers 10.1.1.254
dns-search my.domain.com
```

Apply the settings

```bash
sudo service networking reload

```

##### systemd-tmpfiles

Ubuntu desktop 提供了 `systemd-tmpfiles` 工具與 `tmpfiles.d` 設置檔，來自動管理系統的暫存檔(`/tmp`)。預設每日和系統重啟時，會自動清除目錄 /tmp 下的檔案及子目錄。

- [Configuration of Temporary Files with systemd-tmpfiles | Baeldung on Linux](https://www.baeldung.com/linux/systemd-tmpfiles-configure-temporary-files)
- 預設設定檔：`/usr/lib/systemd/system/systemd-tmpfiles-clean.timer`
- 手動設定檔目錄：`/etc/tmpfiles.d`

```bash
> systemctl list-unit-files | grep tmpfiles

systemd-tmpfiles-clean.service             static          enabled
systemd-tmpfiles-setup-dev.service         static          enabled
systemd-tmpfiles-setup.service             static          enabled
systemd-tmpfiles-clean.timer               static          enabled

>  systemctl status systemd-tmpfiles-clean.timer
● systemd-tmpfiles-clean.timer - Daily Cleanup of Temporary Directories
     Loaded: loaded (/lib/systemd/system/systemd-tmpfiles-clean.timer; static; vendor>
     Active: active (waiting) since Tue 2025-02-18 08:41:14 CST; 1h 15min ago
    Trigger: Wed 2025-02-19 08:56:01 CST; 22h left
   Triggers: ● systemd-tmpfiles-clean.service
       Docs: man:tmpfiles.d(5)
             man:systemd-tmpfiles(8)

 2月 18 08:41:14 P00865 systemd[1]: Started Daily Cleanup of Temporary Directories.

 > man tmpfiles.d
```