複数のLinuxサーバー用にSSHを作成する方法は?

複数のLinuxサーバー用にSSHを作成する方法は?

書き直す*

Virtual Box内で脆弱なWebアプリケーションを実行する2つのLinuxサーバーCentOS 7とDebian 6があります。ホストOSはKali Linuxであり、ホスト専用アダプタ設定を介して両方の仮想マシンに接続されています。 CentOSに正常にsshできますが、Debianにsshするとホストの検証に失敗したというメッセージが表示されます。私の質問は、エラーが発生しないか、複数の仮想マシンに接続せずにdebianにsshを送信する方法です。

「あらかじめ十分な情報を提供できず申し訳ありません。」詳細は知っています。

ssh_config

Host *
#   ForwardAgent no
#   ForwardX11 no
#   ForwardX11Trusted yes
#   RhostsRSAAuthentication no
#   RSAAuthentication yes
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   GSSAPIKeyExchange no
#   GSSAPITrustDNS no
#   BatchMode no
#   -o CheckHostIP no 192.168.56.101
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking no
#   IdentityFile ~/.ssh/identity
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_dsa
#   Port 22
#   Protocol 2,1
#   Cipher 3des
#   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
#   MACs hmac-md5,hmac-sha1,[email protected],hmac-ripemd160
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com

#   RekeyLimit 1G 1h
    SendEnv LANG LC_*
    HashKnownHosts yes
    GSSAPIAuthentication yes
    GSSAPIDelegateCredentials no
    NoHostAuthenticationForLocalhost yes

sshd_config

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 1024

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin without-password
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile     %h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server`enter code here`

ベストアンサー1

2つのオプションがあります。

  • -o "CheckHostIP no"SSHコマンドラインにオプションを追加します。
  • ファイルに次のコードを追加します~/.ssh/config

仮想マシンのホストIPアドレス

ホストIP番号の確認

修正する:

アップデートで得られた情報は正しいですか?ディレクトリ内のファイルの~/.ssh名前は何ですかssh_config?これが本当なら間違いを犯したのです。名前はconfig(なしssh_)で指定する必要があります。

公開した設定で、明らかに次の行を追加しました。

#   -o CheckHostIP no 192.168.56.101

まったく違って見えるでしょう。

Host 192.168.56.101
CheckHostIP no

configVMホストのエントリがユーザーが設定した他のすべての設定から派生するように、ファイルの末尾にこれらの2行を置くことをお勧めします。

おすすめ記事