求助:私有域名,固定公网 ip,如何设置可以通过 ssh 访问?

2018-10-15 16:54:28 +08:00
 zeroze

各位大佬萌新求助!!

自购 vultr,ip:1.2.3.4

有 namecheap 域名:abc.org

其中以有 A 类解析到 1.2.3.4,我自建的 bottle 服务是可以通过 http://abc.org:8080 访问的

但是我 ssh -p 22 root@abc.org 没有反应

请问想通过 ssh root@abc.org 的方式登录 VPS 请问大概需要怎么操作?

5310 次点击
所在节点    DNS
19 条回复
CitizenR
2018-10-15 17:13:40 +08:00
我觉得是不是服务器 ssh 服务禁止远程以 root 身份登陆,或者 ssh 服务换个端口。
MaxTan
2018-10-15 17:18:15 +08:00
改 host
boris1993
2018-10-15 17:18:32 +08:00
首先拿普通用户登录试试
其次永远不要允许 root 远程登录
abclearner
2018-10-15 17:19:35 +08:00
试下用 IP 地址登录 ssh 1.2.3.4@abc.org
或者 vultr 后台 console 看看什么情况
abclearner
2018-10-15 17:20:47 +08:00
上面打错了,ssh root@1.2.3.4
zeroze
2018-10-15 17:33:43 +08:00
@CitizenR vultr 可以直接 ssh root@hostip 登录的感觉不是权限的问题。
zeroze
2018-10-15 17:34:20 +08:00
@abclearner ok 的可以进 shell
zeroze
2018-10-15 17:34:38 +08:00
@boris1993 感谢提醒主要是试一下
xmbaozi
2018-10-15 17:36:16 +08:00
ssh root@abc.org -v
看看报什么错误
zeroze
2018-10-15 17:36:55 +08:00
@MaxTan 好主意,但是我想知道为什么现在这个方法不行,我知道 ddns 比如蒲公英都是可以的,我这个 ip 是静态的应该没问题啊。
zeroze
2018-10-15 17:45:38 +08:00
@xmbaozi
OpenSSH_7.7p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to abc.org port 22.
debug1: Connection established.
debug1: identity file /Users/johndoe/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /Users/johndoe/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/johndoe/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/johndoe/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/johndoe/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/johndoe/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/johndoe/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/johndoe/.ssh/id_ed25519-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/johndoe/.ssh/id_xmss type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/johndoe/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.7
zeroze
2018-10-15 17:46:13 +08:00
ssh_exchange_identification: Connection closed by remote host
CitizenR
2018-10-15 18:58:36 +08:00
@zeroze 看#11 楼报错,貌似是免密登录失败,可以正常连接的。
zeroze
2018-10-15 22:22:31 +08:00
@CitizenR 我没有设置免密登陆,且我 @ip 登陆是需要密码的,是不是可能我 vps,ssh 需要配置一下?
HannibaI
2018-10-15 22:28:39 +08:00
ssh 没开密码登录
victor97
2018-10-15 22:32:58 +08:00
检查下你 ssh client 的 config 文件,貌似是配置了密钥登录,但找不到密钥文件
victor97
2018-10-15 22:36:31 +08:00
或者试一试 ssh root:password@abc.org
zeroze
2018-10-16 09:58:35 +08:00
@victor97
感谢!
请问是 vps 上的 ssh_config 是吗,但是为啥不是改 sshd_config 呢?
是不是
法一:去掉这项的注释 PasswordAuthentication yes 通过密码登录
法二:ssh-keygen 生成一个 id_rsa,再通过本地通过 ssh -i id_ras.pub root@abc.org 登录 VPS
附上 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
# CheckHostIP yes
# AddressFamily any
# ConnectTimeout 0
# StrictHostKeyChecking ask
# IdentityFile ~/.ssh/identity
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# IdentityFile ~/.ssh/id_ecdsa
# IdentityFile ~/.ssh/id_ed25519
# Port 22
# Protocol 2
# Cipher 3des
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
# MACs hmac-md5,hmac-sha1,umac-64@openssh.com,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
zeroze
2018-10-16 09:59:52 +08:00
@HannibaI 感谢感觉就是这个问题

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/497816

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX