I have a server(ubuntu16.04) in aws ec2. And I have a private key to access the server.
The origin user I used called ubuntu
which is generated by aws.
Now my client B wants to login server to synchronize(it's a window10 pc). I don't want to use my aws private key in different places.
So I create a new user which has a limited right called syncusr
.
$ cat /etc/passwd
syncusr:x:1002:1002::/home/syncusr:
I generated ssh-key (ssh-keygen) then append public key to authorized_keys in ~/.ssh
$ ls -ld ~/.ssh; ls -l ~/.ssh
drwx------ 2 syncusr syncusr 4096 May 15 12:14 /home/syncusr/.ssh
total 8
-rw-r--r-- 1 syncusr syncusr 404 May 15 12:13 authorized_keys
-rwxrwxrwx 1 syncusr syncusr 1679 May 15 12:13 id_rsa
Now I download id_rsa and run PuTTYgen got a private key, then I login from client B with username syncusr and private key but failed.
. 2020-05-15 12:17:00.335 Initialised AES-256 SDCTR (AES-NI accelerated) outbound encryption
. 2020-05-15 12:17:00.335 Initialised HMAC-SHA-256 outbound MAC algorithm
. 2020-05-15 12:17:00.335 Initialised AES-256 SDCTR (AES-NI accelerated) inbound encryption
. 2020-05-15 12:17:00.335 Initialised HMAC-SHA-256 inbound MAC algorithm
. 2020-05-15 12:17:00.507 Reading key file "D:\SSHKEY\private_key.ppk"
! 2020-05-15 12:17:00.507 Using username "syncusr".
. 2020-05-15 12:17:00.709 Server offered these authentication methods: publickey
. 2020-05-15 12:17:00.709 Offered public key
! 2020-05-15 12:17:00.901 Server refused our key
. 2020-05-15 12:17:00.918 Server refused our key
. 2020-05-15 12:17:00.918 Server offered these authentication methods: publickey
. 2020-05-15 12:17:00.918 No supported authentication methods available (server sent: publickey)
. 2020-05-15 12:17:00.918 Attempt to close connection due to fatal exception:
* 2020-05-15 12:17:00.918 No supported authentication methods available (server sent: publickey)
which part did I miss?
soltion:
drwx------ 2 /home/sync1/.ssh
total 8
-rw-r--r-- 1 authorized_keys
-rw------- 1 id_rsa
-rwxrwxrwx 1 syncusr syncusr 1679 May 15 12:13 id_rsa
this line means I have the permission.