全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

IP归属甄别会员请立即修改密码
查看: 399|回复: 2
打印 上一主题 下一主题

[Windows VPS] 解决了很久还是没解决 所选的用户密钥未在远程主机上注...

[复制链接]
跳转到指定楼层
1#
发表于 2020-5-6 11:54:09 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 dahai0405 于 2020-5-6 11:59 编辑

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

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


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

# Example 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




2#
发表于 2020-5-6 13:05:12 | 只看该作者
是centos不 前阵子折腾一个 最后搜到是selinux 关闭就好了 其他debian就没遇到过
3#
 楼主| 发表于 2020-5-6 13:32:48 | 只看该作者
yeshang 发表于 2020-5-6 13:05
是centos不 前阵子折腾一个 最后搜到是selinux 关闭就好了 其他debian就没遇到过 ...

是的 centos7
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2026-2-3 01:53 , Processed in 0.058415 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表