Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
07-20-2006, 10:33 AM
|
#1
|
Member
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416
Rep:
|
Cannot ssh inside my network
Hi guys, I was using ssh to connect to a LAMP server downstairs and it was working fine until yesterday after I came back from lunch. I was told to use nmap to scan for open ports. I only see that port 80 is open. Can I use this port for ssh. I keep getting the error: "Conection refused" I'm sorry if I don't make any sense, I'm new to this thing, but I want to learn!!
Thanks...
|
|
|
07-20-2006, 10:51 AM
|
#2
|
LQ Guru
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094
|
You probably could, but you'd have to go downstairs and modify the server configuration.
And since you have to go downstairs anyway to do that, you might as well just go down and open up port 22 on the servers firewall and make sure that sshd is running on the server.
|
|
|
07-20-2006, 11:26 AM
|
#3
|
Member
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416
Original Poster
Rep:
|
Thanks valdez! But sorry to ask you, is there a command to open up port 22 on the servers firewall, meaning on the computer I'm trying to connect? I thought that was done by the network admin. I told to run this command: "ps -A | grep ssh" to see if ssh is running and I got no output from it, what should I do?
Thanks for your help
|
|
|
07-20-2006, 11:34 AM
|
#4
|
LQ Guru
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094
|
On the server, the network admin has to type
Code:
iptables -A INPUT -i eth2 -p tcp --dport 22 -j ACCEPT
Change eth2 to whatever the servers network interface is. Does that server have an ssh server active (I would assume it does)? Do you have a login account on that machine? Are you outside the local network that maybe your IP address is blocked from using ssh? Your admin should be able to help you with all these things.
It looks like the network admin asked you to check your machine for already running ssh sessions, which it appears you don't have any. This just means you couldn't connect.
The only other possibility I can see is that YOUR firewall is blocking outbound access from your machine to port 22. But doubt that. Can you post the output of iptables -L (you probably have to use sudo or be root)?
|
|
|
07-20-2006, 11:59 AM
|
#5
|
Member
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416
Original Poster
Rep:
|
Let me go downstair to get that output. Thanks.
|
|
|
07-20-2006, 12:23 PM
|
#6
|
Member
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416
Original Poster
Rep:
|
Ok this is the output of: "iptables -L"
(after running: "iptables -A INPUT -i eth2 -p tcp --dport 22 -j ACCEPT")
Chain INPUT(policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
Chain FOWARD(policy ACCEPT)
target prot opt source destination
Chain OUTPUT(policy ACCEPT)
target prot opt source destination
Thanks for the help, I will be back in 1 hour. Lunch time!
|
|
|
07-20-2006, 03:03 PM
|
#7
|
Member
Registered: May 2003
Location: NYC
Distribution: CentOS
Posts: 261
Rep:
|
type this in as root:
# service sshd start
Then try to connect.
|
|
|
07-20-2006, 03:49 PM
|
#8
|
Member
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416
Original Poster
Rep:
|
I did a "sudo /etc/init.d/ssh restart"
Isn't this the same?? I'm going downstairs to try anyways.
Thanks, I will let you know in a momemt what happen.
|
|
|
07-20-2006, 04:17 PM
|
#9
|
Member
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416
Original Poster
Rep:
|
NO, no results. When I typed the command "service sshd start" I get:
bash: service command not found.
I tried sshd start and I get: "sshd re-exec requires execution with an absolute path"
What else can I try?? help me please, I'm going nuts!
|
|
|
07-20-2006, 05:34 PM
|
#10
|
Senior Member
Registered: Nov 2004
Distribution: Mandriva mostly, vector 5.1, tried many.Suse gone from HD because bad Novell/Zinblows agreement
Posts: 1,606
Rep:
|
maybe which sshd
then use the full path
|
|
|
07-20-2006, 05:41 PM
|
#11
|
Member
Registered: Apr 2006
Location: Nairobi
Distribution: CentOS
Posts: 78
Rep:
|
Quote:
(after running: "iptables -A INPUT -i eth2 -p tcp --dport 22 -j ACCEPT")
|
is your server using the interface eth2.
try scan(nmap) the server again after "/etc/init.d/sshd start" on the server
|
|
|
07-21-2006, 09:42 AM
|
#12
|
Member
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416
Original Poster
Rep:
|
The server is using interface eth0. I saw downstairs the the server is connected to a router. Could this be the problem? It was working fine 2 days ago.
|
|
|
07-21-2006, 09:51 AM
|
#13
|
Member
Registered: May 2003
Location: NYC
Distribution: CentOS
Posts: 261
Rep:
|
Quote:
Originally Posted by cucolin@
NO, no results. When I typed the command "service sshd start" I get:
bash: service command not found.
I tried sshd start and I get: "sshd re-exec requires execution with an absolute path"
What else can I try?? help me please, I'm going nuts!
|
Then they as root:
# services sshd start
I dont remember whether there was an 's' at the end of that command or not. But try that. If you get an error message something in regards that you cant find "services" command probably your paths arent set up. Then do a search for it as follows as root to find that command:
# cd /
# find . -name services -print
Wait until it finishes...once found ... lets say its in "/usr/bin/services". Then use full path to start sshd daemon as follows:
# /usr/bin/services sshd start
If you get an error saying that process cant be started use this command to see if its already running:
# ps -eaf | grep -i sshd
if the process isnt running then use that services command to start it up. If all else fails check to see if your ssh package is installed usually they come preinstalled with operating system but in your case just double check. Use the following command:
# rpm -aq |grep -i ssh
If its not installed install it using yum as follows:
# yum install ssh
Say yes to all dependencies. Once you confirm that ssh is installed and is running as a daemon try connecting to it again using a "non-root" account. Because some systems block root access using ssh. So from your remote machine connecting to this machine on your remote machine you will type this as follows:
$ ssh ip_address -l username
Make sure you type ip address instead of host name because I dont know if you have DNS setup in /etc/hosts file. If you still cant connect then run this command for temporary purpose to disable your iptables firewall because I dont know if you have it configured correctly. This is done for testing purposes only. Use the services command as follows as root:
# services iptables stop
Once iptables are stopped try connecting from remote machine again. Again double check to make sure "sshd" daemon (process) is running using the ps command before you attempt remote connection. Also before connecting to your remote machine make sure you are connecting to that machine with the same username and password as when you log into it locally. So if you are using the following username to connect locally
username: John
password: smith
then using ssh command you would connect to that machine with those cridentials as follows:
$ ssh ip_address -l John
enter password: smith
Anyway try those troubleshooting steps and post again if you run into problems. Post with exact errors.
Cheers and good luck!
|
|
|
07-21-2006, 10:38 AM
|
#14
|
Member
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416
Original Poster
Rep:
|
Before I do that I wanted to show you the output of the
"sudo netstat -plant | LISTEN" command:
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 5279/mysqld
tcp6 0 0 :::80 :::* LISTEN 10057/apache2
This might help solve the mistery. What does this means??
|
|
|
07-21-2006, 10:52 AM
|
#15
|
Member
Registered: Apr 2006
Location: Nairobi
Distribution: CentOS
Posts: 78
Rep:
|
this confirms that the ssh port is not open. only mysqld(3306) and http(80) are running on the server. You need to start sshd
"/etc/init.d/sshd start"
on the server and check using the same command whether (22) is listening. Let me know how this
goes.
|
|
|
All times are GMT -5. The time now is 07:46 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|