お世話になっております、よろしくお付き合いください。
目的
インターネット上に解説するサーバーを想定して、VMwareゲストOSとしてCentos7サーバーを構築しています。
webサーバーなので、/var/www/html/以下をメンテするユーザー(仮にwebグループのwebuser)はSSH接続(SFTPやSCPなど)させつつも、
古いシステムのためのデータ連携(CSVファイル送受信)のユーザー(仮にwebグループのnonsshuser)はFTPで接続できるようにしようとしています。
質問主旨
CentOS - CentOS7&Vsftpdで非SSHユーザーをFTPできるようにしたい(96994)|teratail
の件で、非SSHユーザーを設定してFTPできるようになったのですが、
逆にこれまでSFTP出来ていたユーザーが認証で通らなくなり困っています。
[preauth]って言葉に振り回されている感じで、穴を開ける前にはつながっていたWinSCPの設定にも困ってます。
かといってSSH全廃するわけにもいかないので、どうにか両立させたいです。
情報不足な点などありましたらご指摘ください。
環境、設定
サーバー側(VMwareのゲストOS、192.168.0.142)
/etc/pam.d/sshd
に
account required pam_access.so accessfile=/etc/security/sshd_access.conf
を追加。
/etc/security/sshd_access.conf
に
+ : webuser : ALL + : user : ALL
を追加。(webuserは /var/www/html/ 編集用ユーザー、user(仮)はシェル利用。)
/etc/ssh/sshd_config
には
(略) # Authentication: #LoginGraceTime 2m #PermitRootLogin yes PermitRootLogin no #StrictModes yes #MaxAuthTries 6 #MaxSessions 10 #RSAAuthentication yes #PubkeyAuthentication yes PubkeyAuthentication no (略) # To disable tunneled clear text passwords, change to no here! #PasswordAuthentication yes #PermitEmptyPasswords no PermitEmptyPasswords no #PasswordAuthentication yes PasswordAuthentication no (略) #KerberosAuthentication no (略) #GSSAPIAuthentication no (略) UsePAM yes (略) Match User nonsshuser PasswordAuthentication yes
nonsshuser(仮)はSSHを使わず、/var/www/html/more/deep/path(仮)をルートディレクトリとしてアクセスできるユーザー。
肝心のvar/log/secure
は
Oct 24 17:38:12 localhost sshd[27360]: Connection from 192.168.0.13 port 57968 on 192.168.0.142 port 22 Oct 24 17:38:12 localhost sshd[27360]: debug1: Client protocol version 2.0; client software version WinSCP_release_5.11.2 Oct 24 17:38:12 localhost sshd[27360]: debug1: no match: WinSCP_release_5.11.2 Oct 24 17:38:12 localhost sshd[27360]: debug1: Enabling compatibility mode for protocol 2.0 Oct 24 17:38:12 localhost sshd[27360]: debug1: Local version string SSH-2.0-OpenSSH_6.6.1 Oct 24 17:38:12 localhost sshd[27360]: debug1: SELinux support enabled [preauth] Oct 24 17:38:12 localhost sshd[27360]: debug1: permanently_set_uid: 74/74 [preauth] Oct 24 17:38:12 localhost sshd[27360]: debug1: list_hostkey_types: ssh-rsa,ecdsa -sha2-nistp256,ssh-ed25519 [preauth] Oct 24 17:38:12 localhost sshd[27360]: debug1: SSH2_MSG_KEXINIT sent [preauth] Oct 24 17:38:12 localhost sshd[27360]: debug1: SSH2_MSG_KEXINIT received [preauth] Oct 24 17:38:12 localhost sshd[27360]: debug1: kex: client->server aes256-ctr hmac-sha2-256 none [preauth] Oct 24 17:38:12 localhost sshd[27360]: debug1: kex: server->client aes256-ctr hmac-sha2-256 none [preauth] Oct 24 17:38:12 localhost sshd[27360]: debug1: kex: curve25519-sha256@libssh.org need=32 dh_need=32 [preauth] Oct 24 17:38:12 localhost sshd[27360]: debug1: kex: curve25519-sha256@libssh.org need=32 dh_need=32 [preauth] Oct 24 17:38:12 localhost sshd[27360]: debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth] Oct 24 17:38:13 localhost sshd[27360]: debug1: SSH2_MSG_NEWKEYS sent [preauth] Oct 24 17:38:13 localhost sshd[27360]: debug1: expecting SSH2_MSG_NEWKEYS [preauth] Oct 24 17:38:13 localhost sshd[27360]: debug1: SSH2_MSG_NEWKEYS received [preauth] Oct 24 17:38:13 localhost sshd[27360]: debug1: KEX done [preauth] Oct 24 17:38:13 localhost sshd[27360]: debug1: userauth-request for user webuser service ssh-connection method none [preauth] Oct 24 17:38:13 localhost sshd[27360]: debug1: attempt 0 failures 0 [preauth] Oct 24 17:38:13 localhost sshd[27360]: debug1: PAM: initializing for "webuser" Oct 24 17:38:13 localhost sshd[27360]: debug1: PAM: setting PAM_RHOST to "192.16 8.0.13" Oct 24 17:38:13 localhost sshd[27360]: debug1: PAM: setting PAM_TTY to "ssh" Oct 24 17:38:13 localhost sshd[27360]: error: Received disconnect from 192.168.0.13: 14: No supported authentication methods available [preauth] Oct 24 17:38:13 localhost sshd[27360]: debug1: do_cleanup [preauth] Oct 24 17:38:13 localhost sshd[27360]: debug1: monitor_read_log: child log fd cl osed Oct 24 17:38:13 localhost sshd[27360]: debug1: do_cleanup Oct 24 17:38:13 localhost sshd[27360]: debug1: PAM: cleanup Oct 24 17:38:13 localhost sshd[27360]: debug1: Killing privsep child 27361
ユーザー側(WindowsホストOS、WinSCPでSFTPしようとしている)
ログファイルはこんな感じ。
. 2017-10-24 17:38:11.791 Looking up host "192.168.0.142" for SSH connection . 2017-10-24 17:38:11.791 Connecting to 192.168.0.142 port 22 . 2017-10-24 17:38:11.791 We claim version: SSH-2.0-WinSCP_release_5.11.2 . 2017-10-24 17:38:11.804 Server version: SSH-2.0-OpenSSH_6.6.1 . 2017-10-24 17:38:11.804 We believe remote version has SSH-2 channel request bug . 2017-10-24 17:38:11.804 Using SSH protocol version 2 . 2017-10-24 17:38:11.804 Have a known host key of type ssh-ed25519 . 2017-10-24 17:38:11.804 Doing ECDH key exchange with curve Curve25519 and hash SHA-256 . 2017-10-24 17:38:12.219 Server also has ecdsa-sha2-nistp256/ssh-rsa host keys, but we don't know any of them . 2017-10-24 17:38:12.220 Host key fingerprint is: . 2017-10-24 17:38:12.220 ssh-ed25519 256 1e:d3:9c:79:8f:9c:e2:f9:03:a9:69:49:e1:01:ca:35 . 2017-10-24 17:38:12.220 Verifying host key ssh-ed25519 0x45f4700d62fad8c2 7f2498cbde78352d d913e573f206fd7a 4990bbfcc834b450 ,0x25dbc0e879f9240e e2c2e71c7d7904b3 89c7d64853411a2b 4dc5b92802963bae with fingerprint ssh-ed25519 256 1e:d3:9c:79:8f:9c:e2:f9:03:a9:69:49:e1:01:ca:35 . 2017-10-24 17:38:12.258 Host key matches cached key . 2017-10-24 17:38:12.258 Initialised AES-256 SDCTR client->server encryption . 2017-10-24 17:38:12.258 Initialised HMAC-SHA-256 client->server MAC algorithm . 2017-10-24 17:38:12.258 Initialised AES-256 SDCTR server->client encryption . 2017-10-24 17:38:12.258 Initialised HMAC-SHA-256 server->client MAC algorithm . 2017-10-24 17:38:12.299 Reading key file "C:\~~~~~~\webuser_private_key.ppk" ! 2017-10-24 17:38:12.300 Using username "webuser". . 2017-10-24 17:38:12.323 Server offered these authentication methods: . 2017-10-24 17:38:12.323 Disconnected: No supported authentication methods available (server sent: ) * 2017-10-24 17:38:12.336 (EFatal) Disconnected: No supported authentication methods available (server sent: ) * 2017-10-24 17:38:12.336 認証ログ (詳細はセッション ログを見て下さい): * 2017-10-24 17:38:12.336 ユーザ名"webuser" を使用中 * 2017-10-24 17:38:12.336 * 2017-10-24 17:38:12.336 認証に失敗


回答1件
あなたの回答
tips
プレビュー