Quantcast
Channel: SSH access denied when 'authorized_keys' file is created with Vim - Server Fault
Viewing all articles
Browse latest Browse all 4

SSH access denied when 'authorized_keys' file is created with Vim

$
0
0

I created an ec2 instance with an Ubuntu 16.04 AMI. I created a sudo user for this AMI with:

sudo adduser myusersudo usermod -aG sudo myuser

Then I attempted to give the user ssh access with an rsa keypair that I already had. I created an .ssh directory for the new user:

mkdir ~/.sshchmod 700 ~/.sshvim ~/.ssh/authorized_keyschmod 600 ~/.ssh/authorized_keys

I copied and pasted my public key into 'authorized_keys'. Then I exited ec2 and tested my connection with:

cd ~/.sshssh -i "mypem.pem" myuser@ec2-xx-xx-xxx-xxx.us-west-1.compute.amazonaws.com

I got an error that read 'Access denied (public key)'

So I scrapped the user and created another user. This time a created the 'authorized_keys' file with nano instead of Vim and it worked.

Anyone experience this?


Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>