LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 01-16-2015, 02:18 PM   #1
Sum1
Member
 
Registered: Jul 2007
Distribution: Fedora, CentOS, and would like to get back to Gentoo
Posts: 332

Rep: Reputation: 30
New CentOS install - cannot remote in via ssh


sshd_config is completely default except for modifying the listening port to 59999.

I can ping the CentOS server from other servers on the LAN.

I've run commands: systemctl start sshd.services and systemctl enable sshd.services. No errors.

I've checked the iptables firewall and it currently indicates under the "filter" section :INPUT ACCEPT (0:0) --- so it would appear everything is open for accepting connections.

When I try to connect from a windows client with putty it just hanges.
When I try to connect from a linux server terminal, the message is: No route to host.

This is my first stab at CentOS and Systemd --- coming from a Slackware and Gentoo background.

What's the simple thing I'm missing?
Thx for your time and patience.

Last edited by Sum1; 01-16-2015 at 02:22 PM.
 
Old 01-16-2015, 02:27 PM   #2
Keruskerfuerst
Senior Member
 
Registered: Oct 2005
Location: Horgau, Germany
Distribution: Manjaro KDE, Win 10
Posts: 2,199

Rep: Reputation: 164Reputation: 164
Is the routing setup correctly? (When I try to connect from a linux server terminal, the message is: No route to host.)

Last edited by Keruskerfuerst; 01-16-2015 at 02:37 PM.
 
Old 01-16-2015, 02:50 PM   #3
Sum1
Member
 
Registered: Jul 2007
Distribution: Fedora, CentOS, and would like to get back to Gentoo
Posts: 332

Original Poster
Rep: Reputation: 30
Hi Kerusk, thanks for your speedy reply.
I'm not sure if routing is setup correctly.
This CentOS environment has thrown me off balance.

I'm used to the old world of going to an iptables file and inputting something like: $IPT -t filter -A INPUT -p tcp --dport 59999 -j ACCEPT. Upon doing that I *~knew~* everything was set for receiving connections on that device and port.

So, I've been doing some surfing and find that many/most folks use firewalld to configure their iptables firewalls and/or firewall services under systemd regime. It turns out there's a gui "firewall-config" app and I added 59999 as a public port. Rebooted the server and now I can remote in via ssh. I don't like this at all....definitely don't understand the format of the /etc/sysconfig/iptables file.

I've got more goog-ing to do. There's got to be a way to get back to simple manual modification of such things.
So this is what web-devs go through implementing new toolchains, libraries, etc? :-)
 
Old 01-16-2015, 02:55 PM   #4
Sum1
Member
 
Registered: Jul 2007
Distribution: Fedora, CentOS, and would like to get back to Gentoo
Posts: 332

Original Poster
Rep: Reputation: 30
Follow up: after CAT-ing the /etc/sysconfig/iptables file, I see no modification showing the port 59999 modification.
I have no idea what configuration file was altered to allow the opening of port 59999.
 
Old 01-16-2015, 03:01 PM   #5
Sum1
Member
 
Registered: Jul 2007
Distribution: Fedora, CentOS, and would like to get back to Gentoo
Posts: 332

Original Poster
Rep: Reputation: 30
Oooof, the port 59999 settings are contained in /etc/firewalld/zones/public.xml

<<i'm gonna need a bourbon>
 
Old 01-16-2015, 03:05 PM   #6
Sum1
Member
 
Registered: Jul 2007
Distribution: Fedora, CentOS, and would like to get back to Gentoo
Posts: 332

Original Poster
Rep: Reputation: 30
and then it occurs to me --- if all i have is shell access to this box once it's installed, how am i going to make modifications without the gui apps for networking services, etc?
 
Old 01-16-2015, 09:20 PM   #7
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
Besides firewall settings, if you're using centos 7 selinux is on by default, and you have to tell selinux about the non-standard ssh port.

I have a couple gui-less centos7 servers, you can manage network settings, etc from the command line fairly easily.
 
Old 01-17-2015, 07:11 AM   #8
Sum1
Member
 
Registered: Jul 2007
Distribution: Fedora, CentOS, and would like to get back to Gentoo
Posts: 332

Original Poster
Rep: Reputation: 30
Hi Doug, thanks for the heads up regarding selinux.
Sounds like I've got some RTFM and learning curve in the centos arena.
Coming from slackware, I'm used to setting up almost every daemon or "service" in the scripts and commands located in /etc/rc.d/.
With centos, I'm not sure when to use systemctl, what is/is not a "service" item, and what configuration files I can edit manually.
I may need to buy a centos 7 reference book to get it straight.
 
Old 01-17-2015, 10:33 AM   #9
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
FYI the command I had to use to set selinux to allow a non-standard port (as root):
Code:
semanage port -a -t ssh_port_t -p tcp <port#>
Read up on systemd. systemctl is used to start/stop/manage daemons. firewall-cmd is used to adjust the new firewalld (iptables replacement). journalctl is used to view the new journald (syslogd replacement). nmtui can adjust network settings for networkmanager controlled interfaces.

This is just a sampling of cli tools, many more are available.
 
Old 01-17-2015, 12:20 PM   #10
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by Sum1 View Post
I'm used to the old world of going to an iptables file and inputting something like: $IPT -t filter -A INPUT -p tcp --dport 59999 -j ACCEPT.
I suggest instead you use default IANA designated port mappings (distro-agnostic /etc/services) and install fail2ban. Let me know if you need the reasoning behind that.


Quote:
Originally Posted by Sum1 View Post
So, I've been doing some surfing and find that many/most folks use firewalld to configure their iptables firewalls and/or firewall services under systemd regime.
Note there is absolutely no reason why you can't use "iptables.service" aka old school /etc/sysconfig/iptables. (If you remove the firewalld package or disable "firewalld.service" the package will still be installed on update unless you exclude it in /etc/yum.conf.)


Quote:
Originally Posted by Sum1 View Post
It turns out there's a gui "firewall-config" app and I added 59999 as a public port. Rebooted the server and now I can remote in via ssh.
CentOS doesn't require 'firewall-config' to configure a fully capabe firewall. Also note changes to iptables rule sets don't require a server reboot: not on CentOS or any other Linux distribution.


Quote:
Originally Posted by Sum1 View Post
I don't like this at all....definitely don't understand the format of the /etc/sysconfig/iptables file.
Again this is not CentOS but distro-agnostic: plain old 'iptables-save' output.


Quote:
Originally Posted by Sum1 View Post
So this is what web-devs go through implementing new toolchains, libraries, etc? :-)
Indeed. Unlike UNIX versions where you first have to portmaster and rebuild your whole ports tree, Linux distributions that come with social contracts, or invite you to fiddle with obscure compile flags, or boast about their pedigree (but in the meanwhile still don't provide packages the rest of the world has been using for decades) with CentOS you just 'yum -y install httpd mysql php' and be done with it. Now that is a hassle, right? ;-p


Quote:
Originally Posted by Sum1 View Post
Sounds like I've got some RTFM and learning curve in the centos arena.
Coming from slackware, I'm used to setting up almost every daemon or "service" in the scripts and commands located in /etc/rc.d/.
With centos, I'm not sure when to use systemctl, what is/is not a "service" item, and what configuration files I can edit manually.
I may need to buy a centos 7 reference book to get it straight.
CentOS is pretty much like any other Linux distribution. Sure you may need to explicitly install some packages if you used the "minimal" installer but under the hood all the basic tools just work. Like Red Hat CentOS has pretty good user, admin and security documentation and a Wiki at centos.org. A GUI for configuring things is not required by CentOS but by users.
 
Old 01-17-2015, 09:51 PM   #11
Sum1
Member
 
Registered: Jul 2007
Distribution: Fedora, CentOS, and would like to get back to Gentoo
Posts: 332

Original Poster
Rep: Reputation: 30
New CentOS install - cannot remote in via ssh

Doug G and unSpawn, thanks for your helpful suggestions. Good material and a framework to get started on. I did some skimming through the mailing list for centos and found the rhel 7 docs are essentially the applicable "manual" for centos 7. Lots of great material there to absorb. I think i can calm down now and begin. Appreciate your help.
 
Old 01-20-2015, 03:41 PM   #12
Sum1
Member
 
Registered: Jul 2007
Distribution: Fedora, CentOS, and would like to get back to Gentoo
Posts: 332

Original Poster
Rep: Reputation: 30
Completed a new Cent 7 install using netinstall.iso. Put it on a USB drive and booted Dell Poweredge 2950 Server with it.
Chose all the package options under "Infrastructure Server."
1071 packages total. Current install size approx. 2.2 GB.
Don't know if I was on a slow mirror, or if the USB device made it slow to install, but it took about 16 - 17 hours to finish.
I was able to ssh into the box on Port 22 after reboot.
I did
Code:
systemctl start sshd.service
and
Code:
systemctl enable sshd.service
.
I like it....no X window system.....straight to shell.....now ready to digest a little systemd, yum package manager, redhat-style services, selinux, lvm, etc.

thanks again.

Last edited by Sum1; 01-20-2015 at 03:59 PM.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Enable remote SSH on clean CentOS 6.5 (minimal) install Deak Linux - Server 8 07-15-2014 03:38 AM
[SOLVED] how to install gui to Centos 6.3 via SSH w/remote control beefydog Linux - Newbie 5 02-12-2013 11:53 AM
[SOLVED] Questions regarding CentOs 6.3 install on HyperV Remote server tcarson Linux - Newbie 5 10-11-2012 01:35 PM
Remote Install Opensuse 10.2 with SSH flyingb SUSE / openSUSE 6 01-26-2007 05:54 PM
Remote install of LFS over SSH fr0zen Linux From Scratch 3 12-14-2003 06:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 06:36 PM.

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
Open Source Consulting | Domain Registration