LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   unable to access ssh anywhere on port 22 (https://www.linuxquestions.org/questions/linux-newbie-8/unable-to-access-ssh-anywhere-on-port-22-a-4175539538/)

chipmunkxiz 04-13-2015 02:44 AM

unable to access ssh anywhere on port 22
 
Hi I'am newbie here,can somebody help me to fix accessing port 22 using ssh anywhere. Please see the sshd_config below:

# Package generated configuration file
# See the sshd(8) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768

# Logging
SyslogFacility LOCAL3
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
AllowUsers root

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

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

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
PasswordAuthentication yes

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

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

UsePAM yes

lazydog 04-13-2015 10:07 AM

Is sshd loaded and running?
Does the firewall allow port 22 through?

suicidaleggroll 04-13-2015 10:26 AM

What do you mean "using ssh anywhere"? What are you trying to do, exactly?

Using SSH on port 22 requires zero changes to the ssh config file. You just need to turn on the sshd service and open up the firewall.

joe_2000 04-13-2015 01:22 PM

Are you talking of a connection within a LAN or are you trying to access a machine that sits behind a router from the www. In the latter case you may have to configure the router to forward port 22 to the machine you want to access.

In any event, for people here to be able to provide useful input it would be helpful if you posted the command you are running to connect to the machine and the output you get.

Also, on the target machine, run
Code:

iptables -L
and post the output so that we can see if you have any firewall rules that would block the connections.

What distro are you running on the target machine?

chipmunkxiz 04-13-2015 09:52 PM

What im trying to do is to access my WD MYCLOUD(server) using Putty from home.
I have no static ip so i setup my router to used DDNS(noip).

I already configure the router to forward port 22 to the machine that i want to access.
I successfully connect to the WD MYCLOUD(server) over the private ip LAN using putty as well.

Before i was successfully access my WD MYCLOUD from home then suddenly something went wrong. Thank you everyone!

------------------------------------------
DISTRO

PRETTY_NAME="Debian GNU/Linux 7 (wheezy)"
NAME="Debian GNU/Linux"
VERSION_ID="7"
VERSION="7 (wheezy)"
ID=debian

------------------------------------------
IPTABLES IS NOT WORKING

~# iptables -L
FATAL: Module ip_tables not found.
iptables v1.4.14: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
------------------------------------------
netstat -tuplen
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
tcp 0 0 0.0.0.0:49152 0.0.0.0:* LISTEN 0 8002 6303/upnp_nas_devic
tcp 0 0 0.0.0.0:36032 0.0.0.0:* LISTEN 0 7661 5766/rpc.mountd
tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN 0 7582 -
tcp 0 0 0.0.0.0:548 0.0.0.0:* LISTEN 0 7773 5884/afpd
tcp 0 0 0.0.0.0:49764 0.0.0.0:* LISTEN 0 7637 5766/rpc.mountd
tcp 0 0 0.0.0.0:33703 0.0.0.0:* LISTEN 0 7649 5766/rpc.mountd
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 0 7719 5800/smbd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 0 4782 3782/rpcbind
tcp 0 0 0.0.0.0:47828 0.0.0.0:* LISTEN 0 7595 -
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 0 7730 5835/vsftpd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 58085 24871/sshd
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 0 7718 5800/smbd
tcp6 0 0 :::2049 :::* LISTEN 0 7586 -
tcp6 0 0 :::139 :::* LISTEN 0 7717 5800/smbd
tcp6 0 0 :::49388 :::* LISTEN 0 7667 5766/rpc.mountd
tcp6 0 0 :::38892 :::* LISTEN 0 7643 5766/rpc.mountd
tcp6 0 0 :::41902 :::* LISTEN 0 7655 5766/rpc.mountd
tcp6 0 0 :::111 :::* LISTEN 0 4785 3782/rpcbind
tcp6 0 0 :::80 :::* LISTEN 0 5591 4081/apache2
tcp6 0 0 :::36145 :::* LISTEN 0 7597 -
tcp6 0 0 :::22 :::* LISTEN 0 58087 24871/sshd
tcp6 0 0 :::443 :::* LISTEN 0 5595 4081/apache2
tcp6 0 0 ::1:4700 :::* LISTEN 0 8372 5885/cnid_metad
tcp6 0 0 :::445 :::* LISTEN 0 7716 5800/smbd
udp 0 0 0.0.0.0:2049 0.0.0.0:* 0 7585 -
udp 0 0 0.0.0.0:111 0.0.0.0:* 0 4780 3782/rpcbind
udp 0 0 10.0.0.255:137 0.0.0.0:* 0 7683 5796/nmbd
udp 0 0 10.0.0.11:137 0.0.0.0:* 0 7682 5796/nmbd
udp 0 0 0.0.0.0:137 0.0.0.0:* 0 7679 5796/nmbd
udp 0 0 10.0.0.255:138 0.0.0.0:* 0 7685 5796/nmbd
udp 0 0 10.0.0.11:138 0.0.0.0:* 0 7684 5796/nmbd
udp 0 0 0.0.0.0:138 0.0.0.0:* 0 7680 5796/nmbd
udp 0 0 0.0.0.0:43270 0.0.0.0:* 0 7646 5766/rpc.mountd
udp 0 0 0.0.0.0:35664 0.0.0.0:* 0 7831 5965/mDNSResponderP
udp 0 0 0.0.0.0:48003 0.0.0.0:* 0 7658 5766/rpc.mountd
udp 0 0 127.0.0.1:23457 0.0.0.0:* 0 8039 6391/wdmcserver
udp 0 0 0.0.0.0:989 0.0.0.0:* 0 4781 3782/rpcbind
udp 0 0 0.0.0.0:5353 0.0.0.0:* 0 7837 5965/mDNSResponderP
udp 0 0 0.0.0.0:44339 0.0.0.0:* 0 7634 5766/rpc.mountd
udp 0 0 127.0.0.1:50817 0.0.0.0:* 0 8003 6303/upnp_nas_devic
udp 0 0 0.0.0.0:59082 0.0.0.0:* 0 7594 -
udp 0 0 0.0.0.0:1900 0.0.0.0:* 0 8005 6303/upnp_nas_devic
udp6 0 0 :::2049 :::* 0 7587 -
udp6 0 0 :::111 :::* 0 4783 3782/rpcbind
udp6 0 0 :::49897 :::* 0 7596 -
udp6 0 0 :::989 :::* 0 4784 3782/rpcbind
udp6 0 0 :::50631 :::* 0 7640 5766/rpc.mountd
udp6 0 0 :::46572 :::* 0 7664 5766/rpc.mountd
udp6 0 0 :::58989 :::*

lazydog 04-14-2015 07:05 AM

Quote:

Originally Posted by chipmunkxiz (Post 5347013)
Before i was successfully access my WD MYCLOUD from home then suddenly something went wrong. Thank you everyone!

Since you are not using static IP did this change?

joe_2000 04-14-2015 12:13 PM

Quote:

Originally Posted by chipmunkxiz (Post 5347013)
Before i was successfully access my WD MYCLOUD from home then suddenly something went wrong. Thank you everyone!

Can you try to be a bit more specific? What command did you run, and what was the error message?

Also your setup still is not clear to me. Is the WD MYCLOUD attached to your router, and you are trying to access it from another box that is a client in the same LAN? Or what do you mean by "from home". We have no way of guessing which part of your setup sits at your "home".

Do you have anything that is located at a remote location? (I am assuming you do, otherwise the dynamic dns stuff would not make sense)

chipmunkxiz 04-14-2015 09:58 PM

I'm using Putty Client to access WD MYCLOUD and i got "network error: connection time out".
The WD MYCLOUD is in the office and attached to the router. I'm trying to access the WD MYCLOUD outside the office.
I saw in the router port forwarding tab that there is a device using ssh.

I just follow this link to setup MY WDCLOUD, but i used the root access http://community.wd.com/t5/My-Book-L...ver/m-p/613713

lazydog 04-15-2015 08:35 AM

Seems there would be a firewall in there somewhere if this is a company office and that would be what is blocking you.

schneidz 04-15-2015 09:20 AM

can you provide diagnostic info from here:
http://www.linuxquestions.org/questi...6/#post5341955

joe_2000 04-15-2015 01:27 PM

Can you actually ping the office ip address? Or validate it's correct in any other way?
E.g. check to what ip the dynamic dns hostname resolves and simultaneously ask someone in your office to got to whatismyip.com or a similar site to verify the two ips are the same...

chipmunkxiz 05-13-2015 10:00 PM

Thanks Guys! Solved!

lazydog 05-14-2015 09:12 AM

And what fixed it?
For the next guy who happens to be looking at this thread for an answer.

chipmunkxiz 05-14-2015 08:12 PM

There is a device using port 22 on a remote location. Thank you!


All times are GMT -5. The time now is 05:12 PM.