LoginSignup
1

More than 5 years have passed since last update.

🔰SSH一部ユーザーだけ、パス無し鍵認証をするメモ

Last updated at Posted at 2018-06-10

久々古いCentOSマシンを触って、、一部ユーザーだけパスワードなし認証を使用と思い、
調べたところ、sshのバージョンが古いと、できなかったのでメモ。

※注意:sshの設定を失敗すると、リモートで作業などしているとそもそもアクセスできなくなり、データセンターに行って直で触らないといけなくなったり要注意です。

sshの設定ファイルを変更


$ sudo vim /etc/ssh/sshd_config

sshd_config
# パスワード認証方式をOFF
PasswordAuthentication no

# 指定ユーザーだけパスワード認証方式をOFF
Match User hoge
    PasswordAuthentication no

今設定した内容の確認

$ /usr/sbin/sshd -t
/etc/ssh/sshd_config: line 91: Bad configuration option: Match
/etc/ssh/sshd_config: terminating, 1 bad configuration options

Bad configuration option: Match
OpenSSHのバージョンが古く、Matchが使えない模様...

Matchコマンドが対応しているバージョンか、確認


$ /usr/bin/ssh -v
OpenSSH_4.3p2, OpenSSL 0.9.8b 04 May 2006
usage: ssh [-1246AaCfgkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-e escape_char] [-F configfile]
           [-i identity_file] [-L [bind_address:]port:host:hostport]
           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
           [-R [bind_address:]port:host:hostport] [-S ctl_path]
           [-w tunnel:tunnel] [user@]hostname [command]

あとは、OpenSSHのアップデートをして、設定反映すればOKなはず。

最近のCentOS6等では、デフォルトでOpenSSH_5.3のはずなので使えるはずですが、
それでもだいぶ古い汗

参考
https://qiita.com/Just4fun/items/17569b6ac6aeabe8dfe8

参考にさせて頂いたサイト様

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
1