, поэтому у меня есть компьютер, который я пытаюсь настроить как сервер дома. У меня на нем установлен ssh-сервер, а ssh-клиент работает на моем ноутбуке. ssh отлично работает, я использую открытые ключи для обеспечения безопасности и отключил пароли.
У меня нет статического ip-адреса, поэтому я получил доменное имя, будет ссылаться на него как на domain.online в следующем, я получил это через namecheap. Я запускаю сервер ubuntu на домашнем сервере и ubuntu на своем ноутбуке. Я настроил ddclient в соответствии с документацией по namecheap и официальной документации ubuntu на DynamicDNS.
Я говорил с представителями namecheap, которые подтвердили, что правильно настроены серверы имен. но когда я пытаюсь выполнить ssh на сервере:
ssh username@domain.online
, мне присваивается a;
connect to host domain.online port 22: connection refused
, я включил переадресацию портов на моем маршрутизаторе. В настоящий момент я нахожусь ssh'd на сервере удаленно, поэтому переадресация портов работает. (я назвал свою жену и посмотрел на ip-адрес в Whatsmyip).
также UFW отключен.
следующим является мой файл ddclient.conf;
es# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf
#pid=/var/run/ddclient.pid
#use=if, if=enp2s0f0
use=web, web=dynamicdns.park-your-domain.com/getip
protocol=namecheap
#ssl=yes
server=dynamicdns.park-your-domain.com
login=domain.online
password=################
www
, и следующее из файла 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/bin:/bin:/usr/sbin:/sbin
# 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.
#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key
# Ciphers and keying
#RekeyLimit default none
# Logging
#SyslogFacility AUTH
#LogLevel INFO
# Authentication:
#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
PubkeyAuthentication yes
RSAAuthentication yes
# Expect .ssh/authorized_keys2 to be disregarded by default in future.
AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2
#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
# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange 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'.
UsePAM yes
#AllowAgentForwarding yes
AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation sandbox
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none
# no default banner path
#Banner none
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
# override default of no subsystems
Subsystem sftp /usr/lib/openssh/sftp-server
# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# PermitTTY no
# ForceCommand cvs server
Я не знаю, нужен ли этот файл, но я решил, что кто-то попросит его
, поэтому, опять же, мой вопрос заключается в том, почему, когда я набираю
ssh username@domain.online
, я получаю ошибку UFW , но когда i
ssh username@00.00.00.00
, я успешно соединяюсь с моим server.
Кроме того, результаты sudo service ddclient status:
ddclient.service - LSB: Update dynamic domain name service entries
Loaded: loaded (/etc/init.d/ddclient; generated; vendor preset: enabled)
Active: active (running) since Tue 2017-06-27 14:21:21 EDT; 23h ago
Docs: man:systemd-sysv-generator(8)
Tasks: 1 (limit: 4915)
Memory: 8.7M
CPU: 5.581s
CGroup: /system.slice/ddclient.service
└─7217 ddclient - sleeping for 10 seconds
Jun 27 14:21:20 computer-name systemd[1]: Starting LSB: Update dynamic domai
Jun 27 14:21:21 computer-name systemd[1]: Started LSB: Update dynamic domain
lines 1-12/12 (END)
попробуйте dig +short "your_domain" @8.8.8.8 выполнить DNS-поиск в общедоступном RNS Google. если ваш аутентичный IP-адрес будет возвращен, вы узнаете, что проблема не в разрешении имени домена.
попробуйте dig +short "your_domain" @8.8.8.8 выполнить DNS-поиск в общедоступном RNS Google. если ваш аутентичный IP-адрес будет возвращен, вы узнаете, что проблема не в разрешении имени домена.