我在 s0 主机上远程拷贝 /etc/hosts 文件到 s1 主机上,出现下面的错误提示:

qiao@s0:~$ scp /etc/hosts root@s2:/etc/
root@s2's password: 
Permission denied, please try again.

解决办法如下:  

sudo gedit /etc/ssh/sshd_config

 

注释掉 PermitRootLogin without-password,添加 PermitRootLogin yes: 

 

# PermitRootLogin without-password
PermitRootLogin yes 

保存,退出

 

 重启 ssh 服务   

sudo service ssh restart 

再次尝试 scp 命令,成功!  

---------------------------------------------------------------------------------------------------------------------------------------

如果仍提示:Permission denied, please try again. 请输入 su 查看是否具有root权限,

如果提示:su: Authentication Failure,

说明当前用户没有root权限,解决方法如下:

sudo passwd

 

重置root密码,取得root权限后再尝试 scp 命令。

 

相关文章:

  • 2022-12-23
  • 2021-06-07
  • 2022-12-23
  • 2022-02-09
  • 2021-10-30
  • 2021-09-22
  • 2021-06-28
猜你喜欢
  • 2021-07-19
  • 2022-12-23
  • 2022-12-23
  • 2021-07-11
  • 2021-10-17
  • 2021-09-22
  • 2021-07-09
相关资源
相似解决方案