大网数据广告活动
服务器运维问答

Where can I find log of an rsync command run on the remote machine?

· 52CE 我爱测

I'm running rsync via ssh to a remote machine. After running the command, I'd like to confirm that the command I sent to the remote machine is the one that actually ran. Is this logged somewhere? The remote machine is a debian bo…

问题原文

原帖链接 · StevieD · CC BY-SA 4.0

I'm running rsync via ssh to a remote machine. After running the command, I'd like to confirm that the command I sent to the remote machine is the one that actually ran. Is this logged somewhere? The remote machine is a debian box.

已采纳解答

原帖链接 · jezzaaaa · CC BY-SA 4.0

Just to be clear, using rsync/rsyncd may be different to this; you're running rsync -> ssh -> sshd -> rsync, so rsyncd is not involved.

By default, rsync does not log what it's doing. If you want to know historically what has been executed in the past, it's possible that sshd may have logged the commands it was given by rsync, but unlikely.

If you just want to know what the command is, run rsync manually, and specify "rsh='ssh -v'" to enable verbose output, and watch for "debug1: Sending command: rsync --server ...".

You can set things up to force logging for the command, by adding this:

command="logger -p user.notice $SSH_ORIGINAL_COMMAND; $SSH_ORIGINAL_COMMAND" ssh-rsa AAAAB3NabcdABCD... rsa-key-bla

to the authorized_keys file, against the key used for logging in. You may want to create a key just for rsync.

Actually, forcing a command causes a log to be written of the command. So that might be all you need.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-06-25)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。