VPS参考测评推荐
专注分享VPS主机优惠信息
衡天云优惠活动
热网互联2026年促销活动
hostkvm优惠促销活动
zji优惠促销活动

解决了很久还是没解决 所选的用户密钥未在远程主机上注…

主机参考:VPS测评参考推荐/专注分享VPS服务器优惠信息!若您是商家可以在本站进行投稿,查看详情!此外我们还提供软文收录、PayPal代付、广告赞助等服务,查看详情!
我们发布的部分优惠活动文章可能存在时效性,购买时建议在本站搜索商家名称可查看相关文章充分了解该商家!若非中文页面可使用Edge浏览器同步翻译!PayPal代付/收录合作

所选的用户密钥未在远程主机上注册,请再试一次!

设置好了 登录任何用户都是 未注册!

useradd user1
useradd user2
useradd user3
useradd user4
useradd user5
useradd user6
useradd user7
useradd user8

mkdir /home/user1/.ssh
cd /home/user1/.ssh
wget -O authorized_keys http://xxx.com/puk/user1.pub   这里的证书是 Xshell 生成的
mkdir /home/user2/.ssh
cd /home/user2/.ssh
wget -O authorized_keys http://xxx.com/puk/user2.pub
mkdir /home/user3/.ssh
cd /home/user3/.ssh
wget -O authorized_keys http://xxx.com/puk/user3.pub
mkdir /home/user4/.ssh
cd /home/user4/.ssh
wget -O authorized_keys http://xxx.com/puk/user4.pub
mkdir /home/user5/.ssh
cd /home/user5/.ssh
wget -O authorized_keys http://xxx.com/puk/user5.pub
mkdir /home/user6/.ssh
cd /home/user6/.ssh
wget -O authorized_keys http://xxx.com/puk/user6.pub
mkdir /home/user7/.ssh
cd /home/user7/.ssh
wget -O authorized_keys http://xxx.com/puk/user7.pub
mkdir /home/user8/.ssh
cd /home/user8/.ssh
wget -O authorized_keys http://xxx.com/puk/user8.pub

chmod g-w /home/user1/.ssh
chmod g-w /home/user2/.ssh
chmod g-w /home/user3/.ssh
chmod g-w /home/user4/.ssh
chmod g-w /home/user5/.ssh
chmod g-w /home/user6/.ssh
chmod g-w /home/user7/.ssh
chmod g-w /home/user8/.ssh

chmod 700 /home/user1/.ssh
chmod 700 /home/user2/.ssh
chmod 700 /home/user3/.ssh
chmod 700 /home/user4/.ssh
chmod 700 /home/user5/.ssh
chmod 700 /home/user6/.ssh
chmod 700 /home/user7/.ssh
chmod 700 /home/user8/.ssh

chmod 600 /home/user1/.ssh/authorized_keys
chmod 600 /home/user2/.ssh/authorized_keys
chmod 600 /home/user3/.ssh/authorized_keys
chmod 600 /home/user4/.ssh/authorized_keys
chmod 600 /home/user5/.ssh/authorized_keys
chmod 600 /home/user6/.ssh/authorized_keys
chmod 600 /home/user7/.ssh/authorized_keys
chmod 600 /home/user8/.ssh/authorized_keys

cp /etc/ssh/sshd_config /etc/ssh/sshd_config_bak

cd /etc/ssh/

rm -rf sshd_config

wget http://xxx.com/puk/sshd_config

sshd_config  内容

#        $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/bin:/usr/bin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

# If you want to change the port on a SELinux system, you have to tell
# SELinux about this change.
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
#
#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

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

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
SyslogFacility AUTHPRIV
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes
MaxAuthTries 3
#MaxSessions 10

PubkeyAuthentication yes

RSAAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile        .ssh/authorized_keys

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

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

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
#PermitEmptyPasswords no
PasswordAuthentication yes

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no

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

# GSSAPI options
GSSAPIAuthentication no
GSSAPICleanupCredentials no
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no
#GSSAPIEnablek5users no

# Set this to ‘yes’ to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of “PermitRootLogin without-password”.
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to ‘no’.
# WARNING: ‘UsePAM no’ is not supported in Red Hat Enterprise Linux and may cause several
# problems.
UsePAM yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation sandbox
#PermitUserEnvironment no
#Compression delayed
ClientAliveInterval 30
#ClientAliveCountMax 3
#ShowPatchLevel no
UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# Accept locale-related environment variables
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 LANGUAGE
AcceptEnv XMODIFIERS

# override default of no subsystems
Subsystem        sftp        /usr/libexec/openssh/sftp-server

# Exle of overriding settings on a per-user basis
#Match User anoncvs
#        X11Forwarding no
#        AllowTcpForwarding no
#        PermitTTY no
#        ForceCommand cvs server

chmod -R 600 sshd_config

systemctl restart sshd

这几篇文章你可能也喜欢:

  • 暂无相关推荐文章

本文由主机参考刊发,转载请注明:解决了很久还是没解决 所选的用户密钥未在远程主机上注… https://dev-web.zhujicankao.com/24573.html

【腾讯云】领8888元采购礼包,抢爆款云服务器 每月 9元起,个人开发者加享折上折!
打赏
转载请注明原文链接:主机参考 » 解决了很久还是没解决 所选的用户密钥未在远程主机上注…
主机参考仅做资料收集,不对商家任何信息及交易做信用担保,购买前请注意风险,有交易纠纷请自行解决!请查阅:特别声明

评论 抢沙发

评论前必须登录!