LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How can I tell if SSH is enabled? (https://www.linuxquestions.org/questions/linux-software-2/how-can-i-tell-if-ssh-is-enabled-810623/)

dor 05-28-2010 02:09 AM

How can I tell if SSH is enabled?
 
I want to make sure that SSH is disabled. Please advice how to do that.

Thank you.

EricTRA 05-28-2010 02:12 AM

Hello,

On Debian based systems you can use:
Code:

/etc/init.d/ssh status
or
Code:

ps -ef | grep sshd
or
Code:

netstat -aln | grep ":22"
Kind regards,

Eric

druuna 05-28-2010 02:13 AM

Hi,

Here are 2 ways:

Check if ssh is running: ps -ef | grep sshd There shouldn't be any output, if there is ssh is up.

You can also check if ssh is listening on its port: netstat -plan | grep ":22"

Hope this helsp.

MrCode 05-28-2010 02:14 AM

You can check to see if the sshd daemon is running with ps ax | grep "sshd"...

EDIT: wow, lots of people got to it before me LOL

dor 05-28-2010 02:28 AM

SSH is up!
 
I forgot to mention that I use Ubuntu 10.4. sorry

Here's my output of what I wrote:
Code:

$ ps -ef | grep sshd
my_username      2314  2296  0 10:25 pts/0    00:00:00 grep --color=auto sshd
$ netstat -plan | grep ":22"
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
$ sudo netstat -plan | grep ":22"
[sudo] password for my_username:

The result of the last command (netstat) is blank. Does it says that SSH isn't listening and therefore I'm safe?
How can I disable it from running?

Thank you all for the quick reply!

EricTRA 05-28-2010 02:32 AM

Hello,

Running:
Code:

sudo /etc/init.d/sshd stop
will stop the daemon if it's running (but it's not) until next boot (unless you disable the startup links using update-rc.d)

Kind regards,

Eric

druuna 05-28-2010 02:32 AM

Hi,

The above output looks ok.

The output of ps -ef | grep .... shows the grep process itself and _not_ the sshd daemon.

sshd is not up and running.

Hope this helps.

cecilieaux 10-04-2015 06:48 PM

Eric,

In response to /etc/init.d/ssh status I got nothing.

However, in response to ps -ef | grep sshd I got

Code:

root      1151    1  0 14:24 ?        00:00:00 /usr/sbin/sshd -D
cecilie+  6412  6323  0 19:41 pts/1    00:00:00 grep --colour=auto sshd

and in response to netstat -aln | grep ":22"

I got

Code:

tcp        0      0 0.0.0.0:22              0.0.0.0:*              LISTEN   
tcp6      0      0 :::22                  :::*                    LISTEN

I'm concerned because of what I read at http://www.pcworld.com/article/29883...dbeyondwindows

I read "Yes, there's a nasty new botnet infecting Linux devices, but your personal PC is probably safe. Here's why." and I worry. I'm still only a few years using Linux Mint 17 (on 17.2 now).

Thanks in advance!

Cecilieaux

debguy 10-19-2015 04:02 PM

if you didnt spend hours reading instructions and configuring IT IS NOT working

install ssh fresh, in debian (up to sqeeze anyhows) it "makes a key" and takes a while doing it

the use "tcpdump" or some tool while using ssh between two hosts on a lan

the data is CLEAR TEXT. that key made is bogus in that it is not used by default for anything.

ssh injects it's headers into your tcp headers but offers NO SECURITY unless you delve into all it's configs and key gens and get it "to work"

---------- Post added 10-19-15 at 05:02 PM ----------

anyone telling you otherwise is probably a hack or a foreign military HOPING YOU WONT KNOW

maples 10-20-2015 07:53 AM

Another way to check- try to connect via SSH:
Code:

ssh localhost
(If the server ran on some other port, add it with the -p option, like "ssh localhost -p 1234")

If you get "connection refused" or similar, then it's not running. If you get a password prompt, a "Permission denied (publickey)" (or similar), or even a shell prompt, SSH is alive and well.

Habitual 10-20-2015 10:56 AM

Quote:

Originally Posted by dor (Post 3983831)
I want to make sure that SSH is disabled. Please advice how to do that.

Thank you.

The question isn't very clear.
ssh is OpenSSH SSH client
sshd is OpenSSH Server.

To which do you refer?

TB0ne 10-20-2015 11:29 AM

Quote:

Originally Posted by debguy (Post 5437075)
if you didnt spend hours reading instructions and configuring IT IS NOT working

install ssh fresh, in debian (up to sqeeze anyhows) it "makes a key" and takes a while doing it the use "tcpdump" or some tool while using ssh between two hosts on a lan the data is CLEAR TEXT. that key made is bogus in that it is not used by default for anything.

ssh injects it's headers into your tcp headers but offers NO SECURITY unless you delve into all it's configs and key gens and get it "to work" anyone telling you otherwise is probably a hack or a foreign military HOPING YOU WONT KNOW

How, exactly, does it 'inject' it's headers into your TCP headers?? Where did you come up with this??? There is nothing in this post that is accurate, and spreading misinformation isn't a good thing.

Try reading up on how things work
https://en.wikipedia.org/wiki/Secure_Shell
http://www.snailbook.com/protocols.html

Even SSH-1 was encrypted end-to-end...there has NEVER been 'clear text' sent over SSH, ever.

Tinkster 12-01-2015 03:19 PM

Quote:

Originally Posted by debguy (Post 5437075)
if you didnt spend hours reading instructions and configuring IT IS NOT working

install ssh fresh, in debian (up to sqeeze anyhows) it "makes a key" and takes a while doing it

the use "tcpdump" or some tool while using ssh between two hosts on a lan

the data is CLEAR TEXT. that key made is bogus in that it is not used by default for anything.

ssh injects it's headers into your tcp headers but offers NO SECURITY unless you delve into all it's configs and key gens and get it "to work"

---------- Post added 10-19-15 at 05:02 PM ----------

anyone telling you otherwise is probably a hack or a foreign military HOPING YOU WONT KNOW



Can you please remain silent if all you have is an false opinion w/ no knowledge or experience to back it?
Your statements are blatantly wrong, and I'm strongly tempted to remove them from the forum.


Regards,
Tink


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