systemd unit: run as "sftpgo" system user

Update the docs too

Fixes #177
This commit is contained in:
Nicola Murino
2020-09-25 18:23:04 +02:00
parent b23276c002
commit 4ebedace1e
4 changed files with 30 additions and 28 deletions

View File

@@ -204,34 +204,12 @@ $ sftpgo initprovider -c /etc/sftpgo
## Install SFTPGo systemd service
Create the systemd service file `/etc/systemd/system/sftpgo.service` with the following content:
Copy the systemd service file.
```shell
[Unit]
Description=SFTPGo Server
After=network.target postgresql.service
[Service]
User=sftpgo
Group=sftpgo
Type=simple
WorkingDirectory=/etc/sftpgo
Environment=SFTPGO_CONFIG_DIR=/etc/sftpgo/
Environment=SFTPGO_LOG_FILE_PATH=
EnvironmentFile=-/etc/sftpgo/sftpgo.env
ExecStart=/usr/bin/sftpgo serve
ExecReload=/bin/kill -s HUP $MAINPID
KillMode=mixed
PrivateTmp=true
Restart=always
RestartSec=10s
[Install]
WantedBy=multi-user.target
sudo install -Dm644 init/sftpgo.service /etc/systemd/system
```
This way SFTPGo will run using the dedicated `sftpgo` user and the service will start after PostgreSQL.
Next, start the SFTPGo service and add it to the system boot.
```shell