LoginSignup
60
47

More than 5 years have passed since last update.

Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

Last updated at Posted at 2018-01-29

SSHでログインできない Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

SSHでログインできなくなりました。

下記でログインできなくなった場合

ログを確認します。

tail /var/log/secure
Jan 31 19:53:43 ik1-316-18051 sshd[28579]: Authentication refused: bad ownership or modes for directory /home/user_name/.ssh

権限的な何かが巻き起こってます。

まきおこりです。

なので、

下記実行します。

chmod 0700 ~/.ssh
chmod 0600 ~/.ssh/authorized_keys

これでいけるはずとクライアント側から再度実行

Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

⚠️ FUCK! ⚠️

そんな気持ちです、、、

悩んで、、、

んっ!

home のディレクトリーの権限を確認してみました。

pwd /home/user_name/
drwxrwxrwx 8 user_name user_name 4096 Jan 29 15:34 user_name

なにっ!

777だ!

まずいのでは、

正確には0700ではと思い、変更、

chmod 700 user_name
ls -ll 
drwx------ 8 user_name user_name 4096 Jan 29 15:34 user_name

これで再度実行

->> ssh vps
Last login: Mon Jan 29 15:34:42 2018 from shichimitoucarashi.com

 _____ _   _ _____  _____  _____ _____ _____                             
/  ___| | | /  __ \/  __ \|  ___/  ___/  ___|                            
\ `--.| | | | /  \/| /  \/| |__ \ `--.\ `--.
 `--. \ | | | |    | |    |  __| `--. \`--. \
/\__/ / |_| | \__/\| \__/\| |___/\__/ /\__/ /
\____/ \___/ \____/ \____/\____/\____/\____/ 

成功です。

悲願達成になりました。

おめでとう

60
47
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
60
47