LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-27-2011, 08:05 AM   #1
OldLodgeSkins
LQ Newbie
 
Registered: Sep 2011
Posts: 2

Rep: Reputation: Disabled
Question Slack 13.37 - Securing the SSH & SSHFS access from the outside


Hi all,

I've got a 13.37 server that's running just fine - I'm very happy with it, it's both my local proxy and development / testing platform.
I'm running into a problem: I'm working more and more often away from home on my laptop. Up until now I did not want to open the SSH access to the outside world, but it seems this is becoming necessary. Especially since I do all my file transfers through SSHFS (even locally, this is so easy to set up that I prefer it over Samba or NFS). So I have two security steps in mind:

1. I want to make sure only normal users - and maybe even just ONE particular user - can log in through SSH from the outside. Especially not root, obviously. As long as I can su at a later time, that's fine, and that's how it should be done anyway. But this, I should be able to figure out on my own I believe, this must be quite common.

2. I'd like to be notified by e-mail each time an SSH login is attempted. If I could get the user name & IP in the e-mail it'd even be better... And this is likely to be more tricky than the first task! Anyone has an idea on how to do that?

In the meantime if you have any further idea on how to make it even safer I'm interested...

Thanks.

Seb.
 
Old 09-27-2011, 08:23 AM   #2
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
There is sticky post on this issue in the Security forum. http://www.linuxquestions.org/questi...tempts-340366/

Short answer:
Use a non-standard port. Port 22 is targeted by automated attack tools.
Use public key authentication. If only you have the key, it is unlikely that anyone will pick the lock.
Disable password logins and root access.

Do not bother with the email alerts. Unsuccessful attempts are not a problem. Successful logins are recorded in /var/log/messages.
 
Old 09-27-2011, 08:34 AM   #3
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,097

Rep: Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174
you can also use an AllowUsers option in /etc/ssh/sshd.conf
Code:
AllowUsers myuser
to let only myuser login by ssh.
 
Old 09-27-2011, 08:54 AM   #4
ozanbaba
Member
 
Registered: May 2003
Location: İzmir
Distribution: Slackware64 15.0 Multilib
Posts: 778

Rep: Reputation: 135Reputation: 135
By the way, Always use passphased keys for login.
 
Old 09-27-2011, 09:05 AM   #5
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,639

Rep: Reputation: Disabled
In addition to the steps already mentioned I use denyhosts (http://denyhosts.sourceforge.net/) which automatically blacklists ip addresses which try to break into your server.

Take a look at the messages log (grep ssh) and you will be amazed at how often your server is attacked. You definitely don't want an email every time.

Brian
 
Old 09-27-2011, 09:33 AM   #6
OldLodgeSkins
LQ Newbie
 
Registered: Sep 2011
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thumbs up

Ok thanks guys, I think with all this I should be able to get it right.
This is important as this is not exactly the kind of subject with which you can take the trial & error route...
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh auto login dead after sshfs install .... Help :-) jv2112 Linux - Newbie 3 07-01-2011 08:18 PM
Single purpose ssh key for sshfs? Mleahy Linux - Security 1 03-07-2010 02:18 AM
Limiting sshfs access to a specific directory, or tunneling nfs over ssh. Jophish Linux - Networking 5 01-24-2010 04:59 AM
How to :: Securing SSH: protocol SSH2 and hiding the direct access of root sysconfig Red Hat 3 09-07-2006 08:30 AM
Securing a system and its SSH install for access from the outside TheOneKEA Linux - Security 4 07-07-2004 03:27 PM

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

All times are GMT -5. The time now is 01:45 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