问题原文
原帖链接 · 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.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
