Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
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.
|
 |
03-10-2010, 10:55 PM
|
#1
|
Member
Registered: Nov 2008
Posts: 38
Rep:
|
change ssh port
Hi i need to change ssh port on the servers including centos and ubuntu
when i make changes to /etc/ssh/sshd.config and change the port to something else
restart sshd
then i can determine that port 22 is not working
but ssh does not connect to new port
it says "no route to the host"
Please help
sandeep
|
|
|
03-10-2010, 11:06 PM
|
#2
|
Member
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 5&6 CentOS 5, 6 & 7
Posts: 573
Rep:
|
Your firewall on the server is probably blocking the new port. You need to modify your firewall to allow access to the new port, and close access to port 22.
|
|
|
03-11-2010, 12:02 AM
|
#3
|
Member
Registered: Nov 2008
Posts: 38
Original Poster
Rep:
|
how do i modify the server firewall
i don't know iptables
thanks
sandeep
|
|
|
03-11-2010, 12:33 AM
|
#4
|
Member
Registered: May 2008
Location: India
Distribution: Ubuntu 10.04, CentOS, Manjaro
Posts: 179
Rep:
|
Hi,
1) Is the server and the PC you want to connect are in the same network?
2) What is the OS on the server?
|
|
|
03-11-2010, 12:40 AM
|
#5
|
Member
Registered: Nov 2008
Posts: 38
Original Poster
Rep:
|
yes they are on the same network
i am using ubuntu 9.10 and centos 5.3
|
|
|
03-11-2010, 12:53 AM
|
#6
|
Member
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 5&6 CentOS 5, 6 & 7
Posts: 573
Rep:
|
Are you able to disable the firewall to confirm it is causing the problem? Obviously if this machine is facing the internet then this isn't a great idea.
I don't know Ubuntu, but you can control the CentOS firewall using the GUI without having to know iptables. Go to System, then Administration and you should find "Security Level and Firewall". If you don't have access to the GUI, then run system-config-security-level-tui from the command prompt.
|
|
|
03-11-2010, 02:07 AM
|
#7
|
Member
Registered: May 2008
Location: India
Distribution: Ubuntu 10.04, CentOS, Manjaro
Posts: 179
Rep:
|
Hi,
On the server do the following
Post the output of
Quote:
cat /etc/sysconfig/network-scripts/ifcfg-<iface>
|
replace <iface> with the actual interface i.e eth0 or eth1 etc..
Verify if sshd is started with the new port
Quote:
netstat -pant | grep ":<new ssh-port>" | grep LISTEN
|
Stop iptables on the server
Quote:
/etc/init.d/iptables stop
|
On the Desktop
How have you configured your network settings command line or GUI
Verify your network settings with the below command
I hope you are trying to connect to the server by mentioning the new port as below
Quote:
ssh -p <new ssh-port> <server-ip>
|
|
|
|
03-11-2010, 03:43 AM
|
#8
|
Member
Registered: Nov 2008
Posts: 38
Original Poster
Rep:
|
Hi All
i tried to change the port once again from /etc/ssh/sshd-config
changed it and
restarted sshd
everything works like charm
i don't know what was happening yesterday
thanks all
|
|
|
03-11-2010, 06:35 AM
|
#9
|
Member
Registered: Jun 2003
Posts: 481
Rep:
|
Just FYI - 'no route to host' is a networking problem... most likely that the IP specified is not on the same subnet. If the problem was a port or firewall issue, the message would have been 'connection refused'.
|
|
1 members found this post helpful.
|
03-11-2010, 04:04 PM
|
#10
|
Member
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 5&6 CentOS 5, 6 & 7
Posts: 573
Rep:
|
Of course it is. I should read the OP more carefully 
|
|
|
All times are GMT -5. The time now is 11:45 AM.
|
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
|
|