我想在我的主目录中运行一个Python脚本,从各种文件中提取数据。但是,要访问这些文件,我需要登录到SSH,然后导航到某个目录。在我的主目录中运行我的脚本时,有没有办法做到这一点?
我会使用scp
复制它们,但是有数千个,所以我不认为这是非常有效的(但这是最后的选择)。谢谢!
发布于 2018-07-27 07:30:09
我推荐使用rsync。这将使您ssh,并在您想要的任何目录上执行r-sync。这(可能)是拉取大量大文件的最有效和最可靠的方法。
rsync -a --progress username@remote_host:destination_directory ~/dir1
发布于 2018-07-27 07:34:31
您可以尝试使用sshfs。有了它,您就可以在本地计算机上挂载一个文件系统,通过ssh连接访问它。
sudo mkdir /mnt/droplet sudo sshfs -o allow_other,defer_permissions root@xxx.xxx.xxx.xxx:/ /mnt/droplet
查看来自digitalocean的这个教程:https://www.digitalocean.com/community/tutorials/how-to-use-sshfs-to-mount-remote-file-systems-over-ssh
https://stackoverflow.com/questions/51548751
复制相似问题