添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
满身肌肉的甜瓜  ·  [Remote-SSH Bug]: ...·  2 天前    · 
老实的钥匙扣  ·  cloud-atlas-draft/deve ...·  4 天前    · 
讲道义的青蛙  ·  Página inicial | ...·  3 月前    · 
挂过科的镜子  ·  Sparse Files - ...·  3 月前    · 
闷骚的李子  ·  Endpoint ID ...·  4 月前    · 
温柔的槟榔  ·  关于Visual Studio ...·  4 月前    · 

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Visit Stack Exchange

Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.

Sign up to join this community

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Moving the key to authorized key:
Command:

cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
bash: /home/user/.ssh/authorized_keys: No such file or directory
                ~/.ssh/authorized_keys are keys of other computers that you connected to/trust, not your own key.
– saiarcot895
                May 15, 2014 at 19:58

The permissions are important! It won't work without the right permissions!

Now you can add the public key to the authorized_keys file:

cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
                @LouisMatthijssen I have copied keys to my remote server. How can I confirm that the public key is added in authorized_keys.
– Aman
                Jan 31, 2019 at 23:39

Since I don't have enough reputation, I'm adding this here. In addition to Louis Matthijssen's answer if you are still not able to login through ssh as a user that you've created, like

ssh username@host

then this may be because of the absence of owner permission that you must add to your /home/username/.ssh folder. I had the same issue and you can give this permission as:

chown -R username:username /home/username/.ssh

This can probably happen simply because you were creating the directory and setting the permissions as root, but not as the username you want to access the server with.

Hope this helps someone.

In case you have been sent the public key in an email to install to a remote server:

1) SSH into the server. I used PuTTY on Windows.

2) Setup the key:

mkdir ~/.ssh
chmod 700 ~/.ssh
vi ~/.ssh/authorized_keys

Take care to copy the key exactly and paste it into a new line in the editor window. Verify that it occupies a single line and save.

chmod 600 ~/.ssh/authorized_keys