LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   How do you close port 22 SSH? (https://www.linuxquestions.org/questions/linux-security-4/how-do-you-close-port-22-ssh-158444/)

Linux~Powered 03-16-2004 10:52 AM

How do you close port 22 SSH?
 
I'm trying to secure my box and so far i've shut down ports in /etc/rc.inet1.conf that i don't use. When i run nmap it says port 22 ssh is open. How do i close this port other than a firewall rule? I looked in the /etc/rc.d directory, but can't figure out how you shut it off. I googled and read that it is to be disabled in /etc/rc.config, but i don't have an rc.config. I have a rc.inetd1.conf where i commented out the other ports i have no use for, but ssh isn't in there. There is a rc.sshd, but i don't see an option to disable it there either.

darkCanuck 03-16-2004 10:56 AM

Why not just turn off sshd?

Linux~Powered 03-16-2004 11:02 AM

That's what i am trying to do! How do i do that?

darkCanuck 03-16-2004 11:07 AM

Do you have a service configuration utility that comes with Slackware? (I'm not familiar with it.) It would be in the main menu under configuration/system settings or the like.

Or check /etc/services (if you have that file). Do a search for ssh and just put a # before that line. Reboot and that should do it. If you don't have that file, just look in /etc for something like serv*

Linux~Powered 03-16-2004 11:29 AM

I have a /etc/service file and commented out the ssh line, rebooted, but tcp port 22 is still open.

ftp 21/tcp #File Transfer [Control]
ftp 21/udp #File Transfer [Control]
#ssh 22/tcp #Secure Shell Login
ssh 22/udp #Secure Shell Login
telnet 23/tcp
telnet 23/udp

darkCanuck 03-16-2004 01:45 PM

Did you try commenting out the UDP below it, as well?

benjithegreat98 03-16-2004 01:52 PM

To permanently end sshd
Code:

/etc/rc.d/rc.sshd stop
chmod -x /etc/rc.d/rc.sshd

The first command ends it and the 2nd command sets the initialization file as not executable. When you reboot, sshd will not start.

Linux~Powered 03-16-2004 11:13 PM

Cool! The /etc/rc.d/rc.sshd stop & chmod -x /etc/rc.d/rc.sshd commands worked. Thanks


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