لقد قمت للتو بإعداد خادم Debian جديد. لقد عطلت SSH الجذر ومصادقة كلمة المرور ، لذا يجب عليك استخدام ملف مفتاح.
بالنسبة لمستخدمي الأساسي ، يعمل كل شيء تمامًا كما هو متوقع. لقد استخدمت ssh-keygen -t dsa
وحصلت لنفسي على مفتاح عام وخاص. ضع أحدهما في المفاتيح المصرح بها ، وضع الآخر في ملف pem محليًا.
أردت إنشاء مستخدم يمكنني نشر الأشياء معه ، لذلك قمت بنفس العملية بشكل أساسي. قمت adduser
بتحريره ، وإنشاء .ssh
مجلد ، وتشغيل ssh-keygen -t dsa
(جربت أيضًا RSA) ، ووضع المفاتيح في مواقعها المناسبة.
لا حظ. أنا أتلقى Permission denied (publickey)
خطأ. عندما أستخدم نفس مفاتيح الحساب الذي يعمل ، نفس الخطأ. عندما أقوم بتمكين مصادقة كلمة المرور ، يمكنني تسجيل الدخول عبر SSH باستخدام كلمة المرور.
كيف يمكنني تصحيح هذا؟
تعديل
إخراج Verbose ssh (loyer.pem هو المفتاح المناسب):
debug2: key: /Users/eli/.ec2/deployer.pem (0x100126830) debug2: key: /Users/eli/.ec2/deployer.pem (0x100126b30) debug2: key: /Users/eli/.ec2/deployer.pem (0x0) debug1: Authentications that can continue: publickey debug3: start over, passed a different list publickey debug3: preferred publickey,keyboard-interactive,password debug3: authmethod_lookup publickey debug3: remaining preferred: keyboard-interactive,password debug3: authmethod_is_enabled publickey debug1: Next authentication method: publickey debug1: Offering public key: /Users/eli/.ssh/id_rsa debug3: send_pubkey_test debug2: we sent a publickey packet, wait for reply debug1: Authentications that can continue: publickey debug1: Offering public key: eli.pem debug3: send_pubkey_test debug2: we sent a publickey packet, wait for reply debug1: Authentications that can continue: publickey debug1: Offering public key: /Users/eli/.ec2/deployer.pem debug3: send_pubkey_test debug2: we sent a publickey packet, wait for reply debug1: Authentications that can continue: publickey debug1: Offering public key: /Users/eli/.ec2/deployer.pem debug3: send_pubkey_test debug2: we sent a publickey packet, wait for reply debug1: Authentications that can continue: publickey debug1: Trying private key: /Users/eli/.ec2/deployer.pem debug1: read PEM private key done: type DSA debug3: sign_and_send_pubkey debug2: we sent a publickey packet, wait for reply debug1: Authentications that can continue: publickey debug2: we did not send a packet, disable method debug1: No more authentication methods to try. Permission denied (publickey).