Rsync to virtual host?

Cron is installed in the sftpgo container but needs to be started.
If pull is not an option, it’s possible to use rsync to connect after enabling rsync as ssh command.

Enter environment:

runagent -m webserver1

To be able to write to the root directory of the sftpgo user 9003, owner and permissions need to be set:

podman exec -ti sftpgo sh
chown root:9003 /srv/sftpgo/data/9003
chmod 775 /srv/sftpgo/data/9003
exit

Edit the sftpgo service using systemctl to override the config so it survives updates:

systemctl --user edit sftpgo

and add following content between the already existing comments:
We’re overriding the ExecStart in the Service section.

### Editing /home/webserver1/.config/systemd/user/sftpgo.service.d/override.conf
### Anything between here and the comment below will become the new contents of the file

[Service]
ExecStart=
ExecStart=/usr/bin/podman run --conmon-pidfile %t/sftpgo.pid \
    --cidfile %t/sftpgo.ctr-id --cgroups=no-conmon \
    --pod-id-file %t/webserver.pod-id --replace -d --name  sftpgo \
    --volume websites:/srv/sftpgo/data:z \
    --volume sftpgo_backups:/srv/sftpgo/backups:Z \
    --volume sftpgo_config:/var/lib/sftpgo:Z \
    --volume %S/state/sftpgo.conf.d/admin.json:/etc/sftpgo/admin.json:Z \
    --env SFTPGO_LOADDATA_FROM=/etc/sftpgo/admin.json \
    --env SFTPGO_HTTPD__WEB_ROOT=${TRAEFIK_PATH}\
    --env SFTPGO_SFTPD__ENABLED_SSH_COMMANDS=rsync \
    --user 0:0 \
    ${SFTPGO_IMAGE}

### Lines below this comment will be discarded

Restart sftpgo:

systemctl --user restart sftpgo

Now it should be possible to use rsync to connect to sftpgo like

rsync -av -e "ssh -p 3092" dump.tar.gz 9003@192.168.3.144:

Maybe we should implement this to the ns8-webserver app and enable cron by default? BTW, I found that cron is missing in ns8-lamp. @stephdl should I open PRs?

Sources:

2 Likes