[英]Unable To access authorized_keys when logging in through ssh and the user is a sudo user
I am connecting to a remote server through SSH abd then switching the user to a sudo user.But then when I am trying to write to the authorized_keys file it is saying...permission denied. 我正在通过SSH abd连接到远程服务器,然后将用户切换为sudo用户,但是当我尝试写入authorized_keys文件时,它说...权限被拒绝。
This is what I am able to see as an output::- " bash: /home/techm/tmsys/Sap1/.ssh/authorized_keys: Permission denied 这是我能够看到的输出::-“ bash:/home/techm/tmsys/Sap1/.ssh/authorized_keys:权限被拒绝
" ”
您可能没有在编辑文件的命令前添加“ sudo”。
If you didn't mess up your system, cat >> ~/.ssh/authorized_keys
(or any other way of appending to this file) will work. 如果您没有弄乱系统, cat >> ~/.ssh/authorized_keys
(或任何其他添加到此文件的方式)将起作用。 Make sure you are in the correct directory ! 确保您在正确的目录中! (In this case by using ~
). (在这种情况下,请使用~
)。 Becoming root to write to your own authorized_keys is not necessary. 无需成为root用户即可写入您自己的authorized_keys。
If the user never used ssh
before then .ssh
will not exist and you can't write to a file in a directory that doesn't exist, so run ssh to create this dir 如果用户之前从未使用过ssh
,那么.ssh
将不存在,并且您无法在不存在的目录中写入文件,因此请运行ssh创建此目录
If it doesn't work than you have a messed up system and this could be caused by a lot of things: 如果它不起作用,则说明您的系统混乱,这可能是由很多原因引起的:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.