1. 问题

root@jenkins-master:~# sudo ssh-copy-id xlj@10.0.0.185
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
xlj@10.0.0.185's password:
sh: 1: cannot create .ssh/authorized_keys: Permission denied

2.原因

权限不够,这个是权限不够的提示

3.解决

1.查看这个用户家目录的权限,发现这个用户的家目录权限不对了

xlj@jenkins-web1:~$ ll
total 32
drwxr-xr-x 5 1000 1000 4096 Oct 15 16:48 ./
drwxr-xr-x 3 root root 4096 Jul 21 09:49 ../
-rw-r--r-- 1 1000 1000  220 Jul 21 09:49 .bash_logout
-rw-r--r-- 1 1000 1000 3771 Jul 21 09:49 .bashrc
drwx------ 2 1000 1000 4096 Jul 21 09:52 .cache/
drwx------ 3 1000 1000 4096 Jul 21 09:52 .gnupg/
-rw-r--r-- 1 1000 1000  807 Jul 21 09:49 .profile
drwxr-xr-x 2 root root 4096 Oct 15 16:48 .ssh/
-rw-r--r-- 1 1000 1000    0 Jul 21 09:57 .sudo_as_admin_successful

2.修改权限

root@jenkins-web1:~# chown xlj.xlj /home/xlj/ -Rroot@jenkins-web1:~# ll /home/xlj/
total 32
drwxr-xr-x 5 xlj  xlj  4096 Oct 15 16:48 ./
drwxr-xr-x 3 root root 4096 Jul 21 09:49 ../
-rw-r--r-- 1 xlj  xlj   220 Jul 21 09:49 .bash_logout
-rw-r--r-- 1 xlj  xlj  3771 Jul 21 09:49 .bashrc
drwx------ 2 xlj  xlj  4096 Jul 21 09:52 .cache/
drwx------ 3 xlj  xlj  4096 Jul 21 09:52 .gnupg/
-rw-r--r-- 1 xlj  xlj   807 Jul 21 09:49 .profile
drwxr-xr-x 2 xlj  xlj  4096 Oct 15 16:48 .ssh/
-rw-r--r-- 1 xlj  xlj     0 Jul 21 09:57 .sudo_as_admin_successful

3.再次测试,就成功了

root@jenkins-master:~# sudo ssh-copy-id xlj@10.0.0.185
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
xlj@10.0.0.185's password: Number of key(s) added: 1Now try logging into the machine, with:   "ssh 'xlj@10.0.0.185'"
and check to make sure that only the key(s) you wanted were added.

mkdir: cannot create directory ‘.ssh’: Permission denied相关推荐

  1. git 报错fatal: cannot create directory at ‘../../..‘: Permission denied

    出现这种情况一般是我们使用git在某个分支开发删除了某个文件夹并且切换到另一个没删除该文件夹的分支后又切回来所以会提示cannot create directory Permission denied ...

  2. hadoop3: mkdir: cannot create directory `/usr/local/hadoop/bin/../logs’: Permission denied

    1.hadoop3: mkdir: cannot create directory `/usr/local/hadoop/bin/../logs': Permission denied 把所有Data ...

  3. mkdir: cannot create directory ‘/soft/hadoop-2.7.3/logs’: Permission denied问题

    启动hadoop时,报错"mkdir: cannot create directory '/soft/hadoop-2.7.3/logs': Permission denied" ...

  4. Failure to create temporary file Permission denied

    chmod -R 777 test/  修改test文件夹下所有文件权限 chmod 777 test  修改test文件夹权限 本地调试文件下载 上传一切正常 上传到服务器后报错 Failure t ...

  5. Ubuntu中cp: cannot create regular file ‘...‘: Permission denied的解决方案

    Ubuntu中cp: cannot create regular file '-': Permission denied的解决方案 在学习<Unix环境高级编程>过程中,为了将下载的 &q ...

  6. su: warning: cannot change directory to : Permission denied ;-bash: bash_profile: Permission denied

    一.查看主目录权限对不对 1:问题描述 [root@ser6-52 ~]# su - mongodb su: warning: cannot change directory to /home/mon ...

  7. Mac mkdir创建文件夹 提示Permission denied

    B00011347:wanghan$ mkdir map-car mkdir: map-car: Permission denied 处理办法: B00011347: wanghan$ sudo mk ...

  8. Linux常见错误 “cp: omitting directory/ cp: :Permission denied”解决办法

    1.问题描述:cp: omitting directory 在Linux系统使用cp(复制命令)复制目录时,常出现错误"cp:omitting directory "dir&quo ...

  9. docker-compose up volumes 调用外部文件,权限问题 cannot open directory xxxxx .: Permission denied

    今天在测试环境上用docker安装测试环境,在nginx 里面,调用外部文件,显示cant open xxx.conf问题. 解决问题思路: 1. 看到pressmission denied 就猜到最 ...

最新文章

  1. 基础通俗讲解集成学习算法
  2. 新增磁盘并把新磁盘虚拟化成逻辑卷,把文件系统/home挂载到这个新逻辑卷
  3. Winform控件:打开文件对话框(OpenFileDialog)
  4. Python OOP总结
  5. 【组合取补集】数三角形 @CQOI2014/BZOJ3505/upcexam3843
  6. 【WebPack】WebPack的安装、使用WebPack打包 js/css/img 等文件
  7. reStructuredText学习
  8. SpringBoot 入门知识点详解
  9. java.util.concurrent包(6)——CyclicBarrier使用
  10. 算法训练 s01串java_试题 算法训练 s01串
  11. nodejs下载安装及配置环境
  12. 用c#实现简单的登录和注册功能
  13. 人都“爆”了有这么好的东西《vtdakz.com》顶硬了!
  14. 怎么判断自己在不在一家好公司?
  15. ovs-vsctl设置ofport不成功处理
  16. 【2023秋招】10月9日字节跳动校招题目以及满分解析
  17. 数据分析师必须掌握的 十三大数据分析方法论!
  18. 学习笔记【Java 虚拟机②】垃圾回收
  19. Android5.1 Telephony流程分析——拨打电话流程(MO CALL)
  20. OC中用字典创建一个具有省市区的应用(简单的字典运用代码)

热门文章

  1. 大流量滤芯保安过滤器
  2. job历史执行记录查询 oracle_Oracle数据库定时任务配置和日志执行情况查询
  3. 深度 | AI芯片终极之战
  4. 走位神器大全排行榜,你们是什么级别的关羽哥?
  5. ECSHOP模板文件功能说明
  6. Eclipse中Tomcat“子容器启动失败”
  7. 电子技术——反馈电压放大器
  8. python 翻转棋(othello)
  9. 豌豆花开花蕊红太平军哥哥一去无影踪
  10. mariadb 卸载 Kali_流氓软件卸载不掉?赶紧试试这款免费专业的卸载神器!专治各类顽固派软件!...