LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-13-2015, 03:44 AM   #1
chipmunkxiz
LQ Newbie
 
Registered: Apr 2015
Posts: 5

Rep: Reputation: Disabled
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
 
Old 04-13-2015, 11:07 AM   #2
lazydog
Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 776
Blog Entries: 1

Rep: Reputation: 122Reputation: 122
Is sshd loaded and running?
Does the firewall allow port 22 through?
 
Old 04-13-2015, 11:26 AM   #3
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
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.
 
Old 04-13-2015, 02:22 PM   #4
joe_2000
Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 808

Rep: Reputation: 216Reputation: 216Reputation: 216
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?
 
Old 04-13-2015, 10:52 PM   #5
chipmunkxiz
LQ Newbie
 
Registered: Apr 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
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 :::*

Last edited by chipmunkxiz; 04-14-2015 at 12:41 AM.
 
Old 04-14-2015, 08:05 AM   #6
lazydog
Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 776
Blog Entries: 1

Rep: Reputation: 122Reputation: 122
Quote:
Originally Posted by chipmunkxiz View Post
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?
 
Old 04-14-2015, 01:13 PM   #7
joe_2000
Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 808

Rep: Reputation: 216Reputation: 216Reputation: 216
Quote:
Originally Posted by chipmunkxiz View Post
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)
 
Old 04-14-2015, 10:58 PM   #8
chipmunkxiz
LQ Newbie
 
Registered: Apr 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
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
 
Old 04-15-2015, 09:35 AM   #9
lazydog
Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 776
Blog Entries: 1

Rep: Reputation: 122Reputation: 122
Seems there would be a firewall in there somewhere if this is a company office and that would be what is blocking you.
 
Old 04-15-2015, 10:20 AM   #10
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,026

Rep: Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845
can you provide diagnostic info from here:
http://www.linuxquestions.org/questi...6/#post5341955
 
Old 04-15-2015, 02:27 PM   #11
joe_2000
Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 808

Rep: Reputation: 216Reputation: 216Reputation: 216
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...
 
Old 05-13-2015, 11:00 PM   #12
chipmunkxiz
LQ Newbie
 
Registered: Apr 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
Thanks Guys! Solved!
 
Old 05-14-2015, 10:12 AM   #13
lazydog
Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 776
Blog Entries: 1

Rep: Reputation: 122Reputation: 122
And what fixed it?
For the next guy who happens to be looking at this thread for an answer.
 
Old 05-14-2015, 09:12 PM   #14
chipmunkxiz
LQ Newbie
 
Registered: Apr 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
There is a device using port 22 on a remote location. Thank you!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SSH to new port, unable to login agriz Linux - Newbie 15 12-01-2011 12:56 AM
SSH unable to access rpm048 Red Hat 7 04-25-2011 04:14 AM
Unable to access port 80 from anywhere but localhost hecter Linux - Security 1 10-07-2004 09:12 AM


All times are GMT -5. The time now is 09:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration