systemd 无法运行 ssh

systemd 无法运行 ssh

命令来自ExcecStart命令行,但不是作为服务。我缺少什么?

尝试将 添加USERGROUP服务中。没有Environment。没有成功。

cat .config/systemd/user/mysync.service

[Unit]
Description = Rsync

[Service]
Type = oneshot
ExecStart = /usr/bin/rsync -avuP raspi:/home/pi/tmp/ /home/foo/Documents/pi/tmp/
Environment = USER=foo
Environment = HOME=/home/foo

[Install]
WantedBy = multi-user.target

[foo@x org]$ systemctl --user daemon-reload

[foo@x org]$ systemctl --user restart mysync.service

Oct 06 14:10:07 x systemd[548]: Starting Rsync...
Oct 06 14:10:07 x rsync[15444]: Permission denied, please try again.
Oct 06 14:10:07 x rsync[15444]: Permission denied, please try again.
Oct 06 14:10:07 x rsync[15444]: root@pi: Permission denied (publickey,password).

cat /home/foo/.ssh/config

Host raspi
HostName 192.168.123.123
User root

我在用着gpg 作为 ssh 密钥

答案1

您需要提供私钥文件:

rsync -options -e "ssh -i /path/to/private-key-file" /source /destination

相关内容