LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-28-2010, 02:09 AM   #1
dor
LQ Newbie
 
Registered: Feb 2010
Posts: 26

Rep: Reputation: 0
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.
 
Old 05-28-2010, 02:12 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
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
 
Old 05-28-2010, 02:13 AM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403
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.
 
Old 05-28-2010, 02:14 AM   #4
MrCode
Member
 
Registered: Aug 2009
Location: Oregon, USA
Distribution: Arch
Posts: 864
Blog Entries: 31

Rep: Reputation: 148Reputation: 148
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
 
Old 05-28-2010, 02:28 AM   #5
dor
LQ Newbie
 
Registered: Feb 2010
Posts: 26

Original Poster
Rep: Reputation: 0
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!
 
Old 05-28-2010, 02:32 AM   #6
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
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

Last edited by EricTRA; 05-28-2010 at 02:34 AM.
 
Old 05-28-2010, 02:32 AM   #7
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403
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.
 
Old 10-04-2015, 06:48 PM   #8
cecilieaux
LQ Newbie
 
Registered: Jan 2013
Location: Washington, DC
Distribution: Linux Mint 19
Posts: 15

Rep: Reputation: Disabled
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
 
Old 10-19-2015, 04:02 PM   #9
debguy
Member
 
Registered: Oct 2014
Location: U.S.A.
Distribution: mixed, mostly debian slackare today
Posts: 207

Rep: Reputation: 19
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
 
Old 10-20-2015, 07:53 AM   #10
maples
Member
 
Registered: Oct 2013
Location: IN, USA
Distribution: Arch, Debian Jessie
Posts: 814

Rep: Reputation: 265Reputation: 265Reputation: 265
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.
 
Old 10-20-2015, 10:56 AM   #11
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by dor View Post
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?
 
Old 10-20-2015, 11:29 AM   #12
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 25,815

Rep: Reputation: 7747Reputation: 7747Reputation: 7747Reputation: 7747Reputation: 7747Reputation: 7747Reputation: 7747Reputation: 7747Reputation: 7747Reputation: 7747Reputation: 7747
Quote:
Originally Posted by debguy View Post
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.
 
Old 12-01-2015, 03:19 PM   #13
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927
Quote:
Originally Posted by debguy View Post
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
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Build kernel with ssh enabled nooobeee Linux - Software 10 02-26-2010 11:58 AM
ssh-agent, ssh-add and ssh-keygen AND CVS raylpc Linux - General 2 11-19-2008 02:50 AM
[sda] Write cache: enabled, read cache: enabled, doesn't support DPO seskissinger Linux - Software 3 05-16-2008 01:17 PM
Passwordless SSH with SSH commercial server and open ssh cereal83 Linux - General 7 04-18-2006 12:34 PM
USB2 Enabled? EwanG Linux - Hardware 0 12-03-2004 07:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

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