You are not logged in.
I do something below:
$ sudo systemctl start sshd.service
$ sudo iptables -A INPUT -p tcp --dport 55022 -j ACCEPT
$ sudo iptables-save > /etc/iptables/iptables.rules
$ sudo systemctl start iptables.service
And the two service are running.
When i ssh to the laptop, alway operation timeout.
here is some my configuration:
/etc/ssh/sshd_config
# $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj 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/sbin:/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.
Port 55022
#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
# 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 yes
#PermitEmptyPasswords no
# Change to no to disable s/key passwords
ChallengeResponseAuthentication no
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
# 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 no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no # pam does that
#PrintLastLog yes
#TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none
# no default banner path
#Banner none
# override default of no subsystems
Subsystem sftp /usr/lib/ssh/sftp-server
# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# PermitTTY no
# ForceCommand cvs server
iptables-save
# Generated by iptables-save v1.8.2 on Thu Mar 14 17:16:49 2019
*nat
:PREROUTING ACCEPT [53:17808]
:INPUT ACCEPT [53:17808]
:OUTPUT ACCEPT [711:45831]
:POSTROUTING ACCEPT [703:45351]
:DOCKER - [0:0]
-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
-A OUTPUT ! -d 127.0.0.0/8 -m addrtype --dst-type LOCAL -j DOCKER
-A POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE
-A DOCKER -i docker0 -j RETURN
COMMIT
# Completed on Thu Mar 14 17:16:49 2019
# Generated by iptables-save v1.8.2 on Thu Mar 14 17:16:49 2019
*filter
:INPUT ACCEPT [26205:15872126]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [25925:10613558]
-A INPUT -p tcp -m tcp --dport 55022 -j ACCEPT
COMMIT
# Completed on Thu Mar 14 17:16:49 2019
ssh -v localhost -p 55022
OpenSSH_7.9p1, OpenSSL 1.1.1b 26 Feb 2019
debug1: Connecting to localhost [::1] port 55022.
debug1: Connection established.
debug1: identity file /home/wagoo/.ssh/id_rsa type 0
debug1: identity file /home/wagoo/.ssh/id_rsa-cert type -1
debug1: identity file /home/wagoo/.ssh/id_dsa type -1
debug1: identity file /home/wagoo/.ssh/id_dsa-cert type -1
debug1: identity file /home/wagoo/.ssh/id_ecdsa type -1
debug1: identity file /home/wagoo/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/wagoo/.ssh/id_ed25519 type -1
debug1: identity file /home/wagoo/.ssh/id_ed25519-cert type -1
debug1: identity file /home/wagoo/.ssh/id_xmss type -1
debug1: identity file /home/wagoo/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.9
debug1: match: OpenSSH_7.9 pat OpenSSH* compat 0x04000000
debug1: Authenticating to localhost:55022 as 'wagoo'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:NHQ5zHoo6APSJ/CxRHdzya7ItMFkaeM51CnuamADsuM
debug1: checking without port identifier
The authenticity of host '[localhost]:55022 ([::1]:55022)' can't be established.
ECDSA key fingerprint is SHA256:NHQ5zHoo6APSJ/CxRHdzya7ItMFkaeM51CnuamADsuM.
Are you sure you want to continue connecting (yes/no)?
What caused this?
How can i solved this problem?
Last edited by dianbanjiu (2019-03-14 09:36:11)
Offline
Hi, please use
[code]<code>[/code]
tags instead of markdown
```<code>```
on these boards as the latter does not work here.
The conntection attempt
The authenticity of host '[localhost]:55022 ([::1]:55022)' can't be established.
ECDSA key fingerprint is SHA256:NHQ5zHoo6APSJ/CxRHdzya7ItMFkaeM51CnuamADsuM.
Are you sure you want to continue connecting (yes/no)?
looks fine until here.
Did you check and accept the host key by typing "yes" and enter?
Last edited by schard (2019-03-14 09:31:56)
macro_rules! yolo { { $($tokens:tt)* } => { unsafe { $($tokens)* } }; }
Offline
Hi, please use
[code]<code>[/code]
tags instead of markdown
```<code>```
on these boards as the latter does not work here.
The conntection attemptThe authenticity of host '[localhost]:55022 ([::1]:55022)' can't be established. ECDSA key fingerprint is SHA256:NHQ5zHoo6APSJ/CxRHdzya7ItMFkaeM51CnuamADsuM. Are you sure you want to continue connecting (yes/no)?
looks fine until here.
Did you check and accept the host key by typing "yes" and enter?
Enter yes,It's worked.
Offline
So is this solved? If so, please edit your first post to prepend [SOLVED] to the title.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
Actually, It's just ' ssh -v localhost' worked.
Offline
So I assume that you are still having issues when connecting from a remote device? Please don't make us guess, tell us exactly what problem you are facing, and provide the relevant output (specifically any messages you get on the client when trying to ssh to the laptop, and messages recorded to the journal on the laptop when the client tries to connect).
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline