0

I'm trying to setup new user which will be able to login with key only. Also, I need to change his home dir to /var/www/website. Here are the steps I've done and result

  1. created a user with useradd mark
  2. generated a key on win machine with puttygen (ssh-2 rsa), added key passphrase, saved private key to .ppk file.
  3. Copied public key into servers authorized_keys file. It is copied in one line (i found that copying in multiple lines can result with problems)

On the server, only logging with key is allowed. The error that I get when I try to connect with new user and new key thru winscp is

No supported authentication methods available (server sent: publickey,gssapi-keyex,gssapi-with-mic).
Server refused our key.
Authentication failed.

whoami; root

ls -ld /home/mark /home/mark/.ssh /home/mark/.ssh/authorized_keys;

drwxrwxrwx 3 mark mark 4096 Nov 19 23:39 /home/mark drwxrwxrwx 2 mark mark 4096 Nov 19 23:41 /home/mark/.ssh -rwxrwxrwx 1 mark mark 401 Nov 20 00:13 /home/mark/.ssh/authorized_keys

full stack of log for one attempt Nov 20 16:33:15 HOSTNAME sshd[12419]: debug1: userauth-request for user mark service ssh-connection method publickey Nov 20 16:33:15 HOSTNAME sshd[12419]: debug1: attempt 1 failures 1 Nov 20 16:33:15 HOSTNAME sshd[12419]: debug2: input_userauth_request: try method publickey Nov 20 16:33:15 HOSTNAME sshd[12419]: debug1: test whether pkalg/pkblob are acceptable Nov 20 16:33:15 HOSTNAME sshd[12419]: debug3: mm_key_allowed entering Nov 20 16:33:15 HOSTNAME sshd[12419]: debug3: mm_request_send entering: type 21 Nov 20 16:33:15 HOSTNAME sshd[12419]: debug3: mm_key_allowed: waiting for MONITOR_ANS_KEYALLOWED Nov 20 16:33:15 HOSTNAME sshd[12419]: debug3: mm_request_receive_expect entering: type 22 Nov 20 16:33:15 HOSTNAME sshd[12419]: debug3: mm_request_receive entering Nov 20 16:33:15 HOSTNAME sshd[12418]: debug3: monitor_read: checking request 21 Nov 20 16:33:15 HOSTNAME sshd[12418]: debug3: mm_answer_keyallowed entering Nov 20 16:33:15 HOSTNAME sshd[12418]: debug3: mm_answer_keyallowed: key_from_blob: 0x7fb00ff9ebc0 Nov 20 16:33:15 HOSTNAME sshd[12418]: debug1: temporarily_use_uid: 508/508 (e=0/0) Nov 20 16:33:15 HOSTNAME sshd[12418]: debug1: trying public key file /home/mark/.ssh/authorized_keys Nov 20 16:33:15 HOSTNAME sshd[12418]: debug1: Could not open authorized keys '/home/mark/.ssh/authorized_keys': Permission denied Nov 20 16:33:15 HOSTNAME sshd[12418]: debug1: restore_uid: 0/0 Nov 20 16:33:15 HOSTNAME sshd[12418]: debug1: temporarily_use_uid: 508/508 (e=0/0) Nov 20 16:33:15 HOSTNAME sshd[12418]: debug1: trying public key file /home/mark/.ssh/authorized_keys Nov 20 16:33:15 HOSTNAME sshd[12418]: debug1: Could not open authorized keys '/home/mark/.ssh/authorized_keys': Permission denied Nov 20 16:33:15 HOSTNAME sshd[12418]: debug1: restore_uid: 0/0 Nov 20 16:33:15 HOSTNAME sshd[12418]: Failed publickey for mark from 178.148.168.147 port 62172 ssh2 Nov 20 16:33:15 HOSTNAME sshd[12418]: debug3: mm_answer_keyallowed: key 0x7fb00ff9ebc0 is not allowed Nov 20 16:33:15 HOSTNAME sshd[12418]: debug3: mm_request_send entering: type 22 Nov 20 16:33:15 HOSTNAME sshd[12418]: debug3: mm_request_receive entering Nov 20 16:33:15 HOSTNAME sshd[12419]: debug2: userauth_pubkey: authenticated 0 pkalg ssh-rsa Nov 20 16:33:15 HOSTNAME sshd[12419]: debug3: Wrote 96 bytes for a total of 1965 Nov 20 16:33:17 HOSTNAME sshd[12419]: Received disconnect from IP : 13: User request Nov 20 16:33:17 HOSTNAME sshd[12419]: debug1: do_cleanup Nov 20 16:33:17 HOSTNAME sshd[12419]: debug3: PAM: sshpam_thread_cleanup entering Nov 20 16:33:17 HOSTNAME sshd[12419]: debug3: mm_request_send entering: type 80 Nov 20 16:33:17 HOSTNAME sshd[12419]: debug3: mm_request_receive_expect entering: type 81 Nov 20 16:33:17 HOSTNAME sshd[12419]: debug3: mm_request_receive entering Nov 20 16:33:17 HOSTNAME sshd[12418]: debug3: monitor_read: checking request 80 Nov 20 16:33:17 HOSTNAME sshd[12418]: debug3: mm_request_send entering: type 81 Nov 20 16:33:17 HOSTNAME sshd[12418]: debug3: mm_request_receive entering Nov 20 16:33:17 HOSTNAME sshd[12418]: debug1: do_cleanup Nov 20 16:33:17 HOSTNAME sshd[12418]: debug1: PAM: cleanup Nov 20 16:33:17 HOSTNAME sshd[12418]: debug3: PAM: sshpam_thread_cleanup entering Nov 20 16:33:22 HOSTNAME sshd[11630]: debug3: Received SSH2_MSG_IGNORE Nov 20 16:33:52 HOSTNAME sshd[11630]: debug3: Received SSH2_MSG_IGNORE Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 80 bytes for a total of 7077 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 96 bytes for a total of 7173 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 4160 bytes for a total of 11333 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 4160 bytes for a total of 15493 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 4160 bytes for a total of 19653 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 8272 bytes for a total of 27925 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 4160 bytes for a total of 32085 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 48533 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 64981 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 81429 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 25892 bytes for a total of 107321 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 35040 bytes for a total of 142361 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 40880 bytes for a total of 183241 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 43800 bytes for a total of 227041 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 35316 bytes for a total of 262357 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 278805 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 295253 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 311701 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 328149 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 344597 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 361045 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 32896 bytes for a total of 393941 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 410389 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 426837 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 443285 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 459733 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 476181 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 492629 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 509077 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 525525 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 541973 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 558421 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 574869 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 591317 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 607765 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 624213 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 640661 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 657109 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 32896 bytes for a total of 690005 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 706453 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 722901 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 739349 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 755797 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 772245 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 788693 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 805141 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 821589 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 838037 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 854485 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 870933 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 887381 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 903829 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 920277 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 936725 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 953173 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 969621 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 986069 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1002517 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1018965 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1035413 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1051861 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1068309 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1084757 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1101205 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1117653 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1134101 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1150549 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1166997 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1183445 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1199893 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1216341 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1232789 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1249237 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1265685 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1282133 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1298581 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1315029 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1331477 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1347925 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1364373 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1380821 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1397269 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1413717 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1430165 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1446613 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1463061 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1479509 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1495957 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1512405 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1528853 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1545301 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1561749 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1578197 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1594645 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1611093 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1627541 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1643989 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1660437 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1676885 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1693333 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1709781 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1726229 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1742677 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1759125 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1775573 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1792021 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1808469 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1824917 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1841365 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1857813 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1874261 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1890709 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1907157 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1923605 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1940053 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1956501 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1972949 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 1989397 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2005845 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2022293 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2038741 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2055189 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2071637 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2088085 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2104533 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2120981 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2137429 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2153877 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2170325 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2186773 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2203221 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2219669 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2236117 Nov 20 16:33:53 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2252565 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2269013 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2285461 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2301909 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2318357 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2334805 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2351253 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2367701 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2384149 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2400597 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2417045 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2433493 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2449941 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2466389 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2482837 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2499285 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2515733 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2532181 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2548629 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2565077 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2581525 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2597973 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2614421 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2630869 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2647317 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2663765 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2680213 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2696661 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2713109 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2729557 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2746005 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2762453 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2778901 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2795349 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2811797 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2828245 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2844693 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2861141 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2877589 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2894037 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2910485 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2926933 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2943381 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2959829 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2976277 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 2992725 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 3009173 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 3025621 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 3042069 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 3058517 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 3074965 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 3091413 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 3107861 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 3124309 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 3140757 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 3157205 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 3173653 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 3190101 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 3206549 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 3222997 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 3239445 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 3255893 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 3272341 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 3288789 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 3305237 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 3321685 Nov 20 16:33:54 HOSTNAME sshd[12187]: debug3: Wrote 16448 bytes for a total of 3338133

Any ideas?

  • did you use puttygen to convert the public key from putty format to openssh format? – Iain Nov 19 '16 at 11:28
  • @Hangin on in quiet desperation No, i used puttygen to create the key - moved the cursor around the screen, added Key passphrase changed number of bits to 2048 and then "save private key" – Aleks Nov 20 '16 at 8:11
1

Your description seems good, but you may have pasted the key in an incorrect way (some typo or a missing character). To help you diagnose the problem, you can do the following:

Edit the config file /etc/ssh/sshd_config, set log level:

LogLevel DEBUG3

and reload ssh

sudo /etc/init.d/ssh reload

This increases the log level for ssh daemon so that you can find out what's going on. Look at ssh log file /var/log/auth.log for problems while trying to login.

  • i get /etc/init.d/ssh: No such file or directory although, i have sshd in that directory – Aleks Nov 19 '16 at 11:02
  • no /var/log/auth.log either. I have /var/log/audit/audit.log where i can find some info about loging, i guess this is it? type=USER_ERR msg=audit(1479553728.025:100688): user pid=13360 uid=0 auid=0 ses=1469 msg='op=PAM:bad_ident acct="?" exe="/usr/sbin/sshd" hostname=cable-MYIP.MYDOMAIN addr=MYIP terminal=ssh res=failed' – Aleks Nov 19 '16 at 11:11
  • @Aleks: What is your distribution? Some paths/files may be different. – Khaled Nov 19 '16 at 11:41
  • CentOS release 6.7 (Final) – Aleks Nov 19 '16 at 11:48
1

Check /var/log/secure for sshd errors. There may be errors due to bad ownership and/or permissions on user's home dir, .ssh dir or authorized_keys file itself so sshd will ignore that file.
Also check AuthorizedKeysFile directive in /etc/ssh/sshd_config: sshd may be configured to look for authorized_keys file somewhere else and not in users home directory. If it is your case, then just put authorized_keys file on right place with right owner and permissions and try one more time.

  • Thanks, this is the error Could not open authorized keys '/home/marko/.ssh/authorized_keys': No such file or directory But i'm not sure why is it looking for his key there, since all other keys are in the /root/.ssh/authorized_keys. Maybe because he is not in the root group? In the config, i have AuthorizedKeysFile .ssh/authorized_keys # Don't read the user's ~/.rhosts and ~/.shosts files #IgnoreRhosts yes should i uncommnet last line ? – Aleks Nov 19 '16 at 19:04
  • @aleks As all other keys are in /root/.ssh/authorized_keys that means all other users could login as root. It's very insecure but if you are comfortable with that, may be better to leave everythin as it is. And the log record Could not open authorized keys '/home/marko/.ssh/authorized_keys... tells that you try to login as user marko while you wrote you've added user mark. So you should check login you use to access server (it should be mark) and put key to /home/mark/.ssh/authorized_keys). And right now better not to change anything in /etc/ssh/sshd_config – Fedor Dikarev Nov 19 '16 at 20:20
  • mark-marko it qas just a typo here, not on server. I've placed file /home/mark/.ssh/authorized_keys and pasted key in it. Now i get different error Could not open authorized keys '/home/mark/.ssh/authorized_keys': Permission denied I've added even 777 to both .ssh folder and authorized_keys file but result stays the same - Permission denied. Thanx for your help – Aleks Nov 19 '16 at 22:46
  • I'm confused on permissions you have and errors you got. Could you share permissions, last errors from ssh and describe what you are doing when get Permission denied error? Next commands should help you: whoami; ls -ld /home/mark /home/mark/.ssh /home/mark/.ssh/authorized_keys; sudo tail /var/log/secure. And you could add this information to your main post so it will be easier to read and understand your problem. – Fedor Dikarev Nov 20 '16 at 8:56
  • and two more commands to check authorized_keys file: wc -l /home/mark/.ssh/authorized_keys; egrep -c -w 'ssh-[rd]sa' /home/mark/.ssh/authorized_keys – Fedor Dikarev Nov 20 '16 at 10:19
0

Sorry, I forget that you use Centos and it has Selinux enabled by default. So in your case you have to allow sshd access folders under /var path. Here is a Centos forum thread describe how to allow sshd access authorized_keys outside /home folder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.