ubuntu18.04 scp Permission denied 权限问题 (Powershell)

环境:
主机OS:Windows10
远程OS:ubuntu18.04 Server
shell: Powershell

问题: 我在根目录下建立了一个文件夹scp,想把所有需要通过scp传输的文件放到这个文件夹里

scp -r .\filesname\ username@ip:/scp

filename : 想要传的文件夹
username: 用户名
ip: 远程机的IP地址

显示没有权限,修改命令为

scp -r .\filesname\ username@ip:/home/username/scp

在用户文件夹下创建文件夹scp,向该文件夹传输文件,结果可以。

PS: scp 默认不允许使用root账号传输文件
如果想用root账号传输文件

  1. 激活root账号
sudo passwd root
  1. 修改sshd配置文件
sudo vi /etc/ssh/sshd_config

末尾加一句

PermitRootLogin yes
  1. 重启sshd服务
sudo systemctl sshd restart
发布了54 篇原创文章 · 获赞 46 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/weixin_40422121/article/details/105558442