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.
This is what I am able to see as an output::- " bash: /home/techm/tmsys/Sap1/.ssh/authorized_keys: Permission denied
"
您可能没有在编辑文件的命令前添加“ sudo”。
If you didn't mess up your system, cat >> ~/.ssh/authorized_keys
(or any other way of appending to this file) will work. 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.
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
If it doesn't work than you have a messed up system and this could be caused by a lot of things:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.