如果您不注冊 SSH 密鑰,我將嘗試拒絕訪問我的家庭服務器。因此,我像這樣編輯/etc/ssh/ssh_config檔案:
Include /etc/ssh/ssh_config.d/*.conf
Host *
# ForwardAgent no
# ForwardX11 no
# ForwardX11Trusted yes
PasswordAuthentication no
# HostbasedAuthentication no
# GSSAPIAuthentication no
# GSSAPIDelegateCredentials no
# GSSAPIKeyExchange no
# GSSAPITrustDNS no
# BatchMode no
# CheckHostIP yes
# AddressFamily any
# ConnectTimeout 0
# StrictHostKeyChecking ask
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# IdentityFile ~/.ssh/id_ecdsa
# IdentityFile ~/.ssh/id_ed25519
# Port 22
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
# MACs hmac-md5,hmac-sha1,[email protected]
# 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
ChallengeResponseAuthentication no
UsePAM no
SAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys
這是在安裝時自動生成的。我添加的更改是:
PasswordAuthentication no
ChallengeResponseAuthentication no
UsePAM no
SAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys
完成這一切并重新啟動 SSH 服務后,我創建了一個新用戶并嘗試登錄,期待一條權限被拒絕訊息,但我收到了密碼提示。我究竟做錯了什么??
uj5u.com熱心網友回復:
為什么我做錯了??
您正在編輯/etc/ssh/ssh_config. 該檔案由 ssh客戶端讀取。您應該正在編輯/etc/ssh/sshd_config. ssh_config對 sshd 沒有影響(好吧,除非您有一些奇怪的特定于發行版的配置設定)。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/451200.html
