scp /localdir/ root@ubuntu: 的目标路径是什么?

What is the target path of scp /localdir/ root@ubuntu:?

注意:我的问题与
非常相似 File location if target path not specified with scp command
但是那个问题是问这个的目标是什么:

scp -r /localdir/ root@ubuntu

我的问题是问这个的目标是什么:

scp -r /localdir/ root@ubuntu:

此外,如果有人好奇,我在以下网页上发现了这种语法:
https://kubernetes.io/docs/setup/independent/high-availability/#copy-required-files-to-the-correct-locations

这是一个 Bash 脚本:

USER=ubuntu # customizable
CONTROL_PLANE_IPS="10.0.0.7 10.0.0.8"
for host in ${CONTROL_PLANE_IPS}; do
    scp /etc/kubernetes/pki/ca.crt "${USER}"@$host:
    scp /etc/kubernetes/pki/ca.key "${USER}"@$host:
    scp /etc/kubernetes/pki/sa.key "${USER}"@$host:
    scp /etc/kubernetes/pki/sa.pub "${USER}"@$host:
    scp /etc/kubernetes/pki/front-proxy-ca.crt "${USER}"@$host:
    scp /etc/kubernetes/pki/front-proxy-ca.key "${USER}"@$host:
done

在我的测试中,我 运行 命令如下,将 test 文件夹从主机 heron01 复制到主机 heron02:

yitian@heron01:~$ scp -r test/ yitian@heron02:

结果显示 test 文件夹位于:

yitian@heron02:~$ pwd
/home/yitian

所以,你的问题的结果是:目标目录是你在scp命令中使用的目标用户的home directory。在我的示例中,目标目录是:/home/yitian in host heron02.