scp:
使用scp从远程服务器导出文件的命令如下:
scp remote_username@remote_ip:/path/to/target_file /path/to/local_folder
从本地复制到远程服务器的命令如下:
scp /path/to/local_file remote_username@remote_ip:/path/to/target_folder
如果是目录的话,加上- r
选项即可:
scp -r remote_username@remote_ip:/path/to/target_file /path/to/local_folder
scp -r /path/to/local_file remote_username@remote_ip:/path/to/target_folder
不过在使用scp
时可能会出现Permission denied
的问题,这是由于本地的权限不足造成的,有一些blog
说去修改/etc/ssh/sshd_config
文件,但也是权限不足无法修改,后来尝试了使用sftp
可以解决这个问题
首先,使用sftp远程连接服务器:
sftp remote_username@remote_ip
接着输入密码,然后使用get命令导出文件:
sftp> get /path/to/remote/file /path/to/local/destination
最后,使用exit
命令退出即可。😀😀😀