• ベストアンサー

SSHサーバーとPAMについて

現在SSHサーバーを立てて内部、外部からログインをして、sshd_configファイルをいじりながら勉強をしています。 一点ご質問がございます。 「sshd_configファイルにある、UsePAMの項目をNOにするとログイン可、YESにするとログイン不可になります。PAM認証についてインターネットで調べたのですが、どうして、UsePAMの項目をYESにするとログインが不可になるのかが理解できませんでした」 もし解る方がいましたら教えて頂けないでしょうか。 宜しくお願いします。

noname#230476
noname#230476

質問者が選んだベストアンサー

  • ベストアンサー
  • notnot
  • ベストアンサー率47% (4846/10257)
回答No.1

私の所ではyesで大丈夫です。 pamの設定で、sshdについて設定してありますか?設定ファイルはOSによって違いますが、Fedora9だと/etc/pam.d/sshd

その他の回答 (2)

回答No.3

以下の参考URLが参考になると思います. 3.15 - OpenSSH のバージョンと PAM のふるまいについて。

参考URL:
http://www.openssh.com/ja/faq.html
  • nikogoo
  • ベストアンサー率21% (18/85)
回答No.2

http://www.atmarkit.co.jp/flinux/samba/sambatips02/sambatips02.html 余り確かなことはいえませんが、おそらくPAM認証の設定ファイルでSSH関連の設定がOFF(あるいはON)になっているからではないでしょうか? お使いのサーバーは推測するにRedHat系ですよね? 参考まで。

関連するQ&A

  • 特定ホストからのみSSHでのrootログインを許可

    2台のサーバ間でrootユーザー所有のファイルの同期を rsyncで行う為、ssh_configでrootログインを許可しています。 ココでセキュリティの関係上、sshでのrootログインを特定の ホストからのみ許可したいと思ってます。 /etc/security/access.confに以下を追記 -:root : ALL EXCEPT 192.168.**.**. /etc/pam.d/sshdに以下を追記 account required pam_access.so /etc/ssh/sshd_config UserPAM yes と言う設定をしましたが、これ以外に有効な方法はありますでしょうか? (この方法だと厳密には、「認証を通さない」設定になるかと思います) ありましたら、教えて頂きたいと思います。

  • rootでのsshログインを許可したいのですが、何故か出来ません。

    rootでのsshログインを許可したいのですが、何故か出来ません。 sshサーバ環境 CentOS release 5.5 (Final) OpenSSH_4.3p2 sshサーバの「/etc/ssh/sshd_config」の内容は以下の通りです。 #「/etc/ssh/sshd_config」 Protocol 2,1 ListenAddress 0.0.0.0 SyslogFacility AUTHPRIV PermitRootLogin yes RSAAuthentication yes PubkeyAuthentication yes IgnoreRhosts yes PermitEmptyPasswords no PasswordAuthentication yes ChallengeResponseAuthentication no GSSAPIAuthentication yes GSSAPICleanupCredentials yes UsePAM yes AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT AcceptEnv LC_IDENTIFICATION LC_ALL X11Forwarding yes Subsystem sftp /usr/libexec/openssh/sftp-server #---------- なお、その他の項目はコメントアウトされています。 調べてみますと「PermitRootLogin」をyesにしてsshdを再起動(/etc/rc.d/init.d/sshd restart)すれば良いとありますが、それでもrootでsshログインが出来ません。なお、一般ユーザではsshでログイン可能です。 sshdサーバでの「/var/log/secure」では、以下のようにあります。 Aug 27 16:52:22 hogehoge sshd[2543]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=xxx.com user=root Aug 27 16:52:25 hogehoge sshd[2543]: Failed password for root from xxx.xxx.xxx.xxx port 37192 ssh2 原因として何が考えられますでしょうか。

  • RedHat6 SSH

    おそれいります。 RedHatEnterpriseにて、sshを開通させようとしているのですがうまくいきません。 ssh-keygen -t rsa ⇒ ssh-copy-idにてauthorized_keysを作成しました。 デーモンで立ち上げると接続できず、/usr/sbin/sshdで立ち上げると、クライアントからログインできるので、鍵のペアはとおっている模様です。 sshd_configの設定の問題なのか、様々試しましたがダメでした。 StrictModes yes PubkeyAuthentication yes RSAAuthentication yes PermitRootLogin no ChallengeResponseAuthentication no PermitEmptyPasswords no PasswordAuthentication no GSSAPIAuthentication yes GSSAPICleanupCredentials yes IgnoreRhosts yes IgnoreUserKnownHosts no PrintMotd yes StrictModes yes 以上のように設定しています。 よろしくお願いします。

  • RedHatLinuxのSSHサーバをアクセス制御したいです

    RedHatLinuxでSSHサーバを使用する際に、アクセスの制御をしたいと思います。 rootのログインを拒否するのは、 vi /etc/ssh/sshd_config # PermitRootLogin yes → コメントをはずして、PermitRootLogin no にすると思うのですが、 ログインできるユーザを限定する場合は、 AllowUsersの個所を修正すると聞いたのですが、 sshd_configの中に、そうゆう個所はありませんでした。 どのようにしたら良いのでしょうか?

  • SSHアクセスが出来ない

    Ubuntuにsshを入れて、公開鍵認証でwindowsからリモートアクセスしようとしましたができません。 Ubuntu側手順としては、 1. sudo ssh-keygen -t rsaで、パスフレーズ設定 2. sudo mv /root/.ssh/id_rsa.pub /root/.ssh/authorized_keysで公開鍵設定 3. sudo mv /root/.ssh/id_rsa /media/usbでUSBメモリに秘密鍵をコピー そしてwindows側は、TeraTermを使って、 ユーザ名、パスフレーズ(上記で設定したもの)、秘密鍵(USBメモリのid_rsaファイルを指定)を設定してログイン(SSH2) といった、通常の操作をしております。パスワード認証にすると問題なくできましたので、ネットワークの問題ではなさそうです。 なお、ubuntu側で事前にやった事としては、 /etc/.ssh/sshd_configファイルのPermitRootLoginをyes->noに変更、PasswordAutheticationをyes->noに変更のみです。設定後にSSHサーバを再起動させています。 詳しい方がいましたら、よろしくお願い致します。

  • puttyで接続したらserver unexpectedly closed network connectionというエラーがでました。

    Putty でパスワードを入力した直後に server unexpectedly closed network connection というエラーが発生しログインできませんでした。 ちょっと調べてみたら、 /etc/ssh/sshd_config で #UsePAM yes UsePAM no とすれば良いと書いてあったのですが、以下の点がわかりません。 ・/etc/ssh/sshd_config の sshd_configというのはディレクトリでしょうか?むしろ/etc/のなかに/ssh/というディレクトリが存在しないのですがどうすればいいのでしょうか? ・サーバにアクセスできないのにどうやって修正すればいいのでしょうか? 以上どうぞよろしくお願いします。

  • SSHをLDAPで認証

    SSHをLDAPを使って認証させたいのですが、上手くいきません・・・ /etc/passwdに登録してあるユーザはログイン可能なのですが、LDAPに登録してあるユーザではログインできません。以下、ログイン不能時のログです。 ※LDAPのログには、何も記述されていないので、そもそもSSHからLDAPサーバにアクセスできていないように思うのです。しかしながら、どうして良いか全く分からないため、皆様の知恵をお借りしたく。 --------log--------- Illegal user test from 127.0.0.1 May 11 10:13:07 Proxy sshd[23596]: PAM unable to dlopen(/lib/security/pam_ldap.so) May 11 10:13:07 Proxy sshd[23596]: PAM [dlerror: /lib/security/pam_ldap.so: undefined symbol: ber_pvt_opt_on] May 11 10:13:07 Proxy sshd[23596]: PAM adding faulty module: /lib/security/pam_ldap.so May 11 10:13:36 Proxy sshd[23596]: Failed password for illegal user test from 127.0.0.1 port 35168 ssh2 --------------------- /etc/pam.d/sshdに関しては、pam_ldapのソース内にあったものをそのまま流用しています。 ■基本情報 OS:Redhat 2.4.21-4.EL openldap-2.3.21 pam_ldap-182 nss_ldap-250 LDAPクライアント、サーバとも同一サーバ。

  • SSHに繋がらない

    SSHから接続できず、ユーザー認証でエラーになってしまいます。 何かわかる方がいらっしゃいましたら、どうか少し教えて頂けないでしょうか。 OSはCentOS 6.2 です。 -------------------------------------------------------------------- ■サーバー -------------------------------------------------------------------- ★設定 # vi /etc/ssh/sshd_conf > Port 22 > Protocol 2 > AllowTcpForwarding yes > GatewayPorts no > MaxAuthTries 6 > MaxSessions 10 > > ServerKeyBits 1024 > StrictModes yes > > SyslogFacility AUTHPRIV > LogLevel DEBUG3 > > PubkeyAuthentication yes > PasswordAuthentication no > PermitEmptyPasswords no > AuthorizedKeysFile .ssh/authorized_keys > > PermitRootLogin without-password > UsePrivilegeSeparation yes > > Subsystem sftp /usr/libexec/openssh/sftp-server > X11Forwarding no ★鍵を作成 # su user1 $ ssh-keygen -t rsa -b 1024 $ Generating public/private rsa key pair. $ Enter file in which to save the key (/user1/.ssh/id_rsa): $ Enter passphrase (empty for no passphrase): $ Enter same passphrase again: $ Your identification has been saved in /user1/.ssh/id_rsa. $ Your public key has been saved in /user1/.ssh/id_rsa.pub. $ The key fingerprint is: $ 50:4f:72:d4:0a:d6:d2:24:98:96:7b:xx:xx:xx:xx:xx user1@myhost.com $ The key's randomart image is: ★鍵の名前を変更 $ cd /home/user1/.ssh/ $ cp id_rsa.pub authorised_keys $ rm id_rsa.pub ★パーミッション確認 $ drwxr-xr-x. root root /etc/ssh $ -rw------- root root /etc/ssh/sshd_conf $ drwxr-xr-x. user1 user1 /home/user1 $ drwxr-xr-x user1 user1 /home/user1/.ssh $ -rw-r--r-- user1 user1 /home/user1/.ssh/authorised_keys ★再起動 # service sshd restart # Stopping sshd: OK ] # Starting sshd: OK ] -------------------------------------------------------------------- ■クライアント -------------------------------------------------------------------- Windows7 teraterm ポート:22 SSHバージョン:SSH2 ユーザー名・パスフレーズを入力し、「RSA/DSA鍵を使う」に上記で作った「id_rsa」プライベート鍵をセット。 エラーメッセージ:「SSH2自動ログインエラー:ユーザー認証が失敗しました」 -------------------------------------------------------------------- ■ ログ(/var/log/secure)抜粋 -------------------------------------------------------------------- Aug 6 17:57:26 localhost sshd[21819]: debug1: temporarily_use_uid: 0/0 (e=0/0) Aug 6 17:57:26 localhost sshd[21819]: debug1: trying public key file /user1/.ssh/authorized_keys Aug 6 17:57:26 localhost sshd[21819]: debug1: restore_uid: 0/0 Aug 6 17:57:26 localhost sshd[21819]: debug1: temporarily_use_uid: 0/0 (e=0/0) Aug 6 17:57:26 localhost sshd[21819]: debug1: trying public key file /user1/.ssh/authorized_keys Aug 6 17:57:26 localhost sshd[21819]: debug1: restore_uid: 0/0 Aug 6 17:57:26 localhost sshd[21819]: Failed publickey for user1 from yyy.yyy.yyy.yyy port 58193 ssh2 Aug 6 17:57:26 localhost sshd[21819]: debug3: mm_answer_keyallowed: key 0x7fc196d47cf0 is not allowed Aug 6 17:57:26 localhost sshd[21819]: debug3: mm_request_send entering: type 22 Aug 6 17:57:26 localhost sshd[21819]: debug3: mm_request_receive entering Aug 6 17:57:26 localhost sshd[21820]: debug2: userauth_pubkey: authenticated 0 pkalg ssh-rsa Aug 6 17:57:26 localhost sshd[21820]: debug3: Wrote 68 bytes for a total of 2633 Aug 6 17:57:26 localhost sshd[21820]: Connection closed by yyy.yyy.yyy.yyy ※yyy.yyy.yyy.yyyは、teratermでアクセスしたIPです。 -------------------------------------------------------------------- ■備考 -------------------------------------------------------------------- 「nmap localhost」は「22/tcp open ssh」ですが、 グローバルIPで「nmap xxx.xxx.xxx.xxx」すると、22番がリストに出ませんでした。 ルーター、iptables、ともにポートは開けています。 (念のため、「iptables」と「system-config-firewall」は停止しています。) ログを見ると、sshdまで到達しているように見えるのですが・・・。

  • 玄箱(debian)でSFTPサーバーの設定について

    外部からのアクセスをsftpのみのサーバーをと考えているのですが、sshd_configの設定がうまくいかず、sshでのローカルからのログインも出来なくなってしまうと事態になってしまいます。(telnetで復帰処理で元に戻しています。) PasswordAuthentication yes Subsystem sftp internal-sftp {ここより上までは問題なし} Match group sftponly ChrootDirectory /mnt/root AllowTcpForwarding no ForceCommand internal-sftp {ここまでを入れるとsftponlyでないグループのユーザーもsshでログイン不可になる。} といった状態です。 sshのバージョンは5.2p1、mnt/rootのパーミッションは755,root:root です。インターネットで見聞きした知識しか無く的外れなことを言ってるかもしれませんがご教示お願います。

  • rootでSSHできないように設定しても他のユーザーからsuできてしまう

    Fedora Core 6 で /etc/ssh/sshd_conig 内のデフォルト値 #PermitRootLogin yes を PermitRootLogin no にして案の定外部からSSHでのルートでのログインはできないようにしたのですが、Puttyなどで、他のユーザーでログインした後、su を使うとパスワードを入れればrootに切り替えられます。 これは正常なのでしょうか?リモートの場合はrootにsuできないようにしたいのですが特別な設定が必要になるのでしょうか? ご存知の方どうぞよろしくお願いいたします。