CariNet Forums  
Go Back   CariNet Forums > Hardening Your Server

Reply
 
Thread Tools Search this Thread Display Modes
Old 05-12-2008, 04:23 PM   #1 (permalink)
Junior Member
 
Join Date: May 2008
Location: Italy (Sardinia Island)
Posts: 3
Send a message via MSN to srgeneral Send a message via Yahoo to srgeneral Send a message via Skype™ to srgeneral
Default HOWTO: SSHd Linux Harding

For maximize the server security disable the DIRECT ROOT LOGIN in your SSHd.

1. add a new normla user in your server and assign a new password (like use a long password and use numbers and letters).

[root@servername ~]# adduser USERNAME

[root@servername ~]# passwd USERNAME

And insert the your password.

2. Go in the SSHd Config and change the configuration for don't allowed a DIRECT ROOT LOGIN.

[root@servername ~]# cd /etc/ssh/

[root@servername ~]# nano sshd_config (or use another editor pico o vi)

search in the config this text

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6

and change

#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6

3. Sava this config and restard a SSHd.

[root@servername ~]# /etc/init.d/sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]


If you try to login with a root user received an error, for login use your new user and for up with a root user use a comand su -
__________________
Marco Saiu
SR General CEO
m.saiu@srgeneral.com
srgeneral is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Share on FacebookStumble this Post!Google Bookmark this Post!Bookmark to Slashdot!
Reply With Quote
Old 05-13-2008, 10:51 AM   #2 (permalink)
Cari.net Staff
 
Shayan's Avatar
 
Join Date: May 2008
Location: San Diego, California
Posts: 15
Thumbs up

Great post. Preventing illegitimate SSH access to a dedicated server is one of the most important, if not the most important, hack-prevention measures you can take.
Shayan is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Share on FacebookStumble this Post!Google Bookmark this Post!Bookmark to Slashdot!
Reply With Quote
Old 05-14-2008, 04:58 AM   #3 (permalink)
Junior Member
 
Join Date: May 2008
Location: the metaverse
Posts: 15
Default

More advice:
First, keep your session running and simply HUP the sshd if you can. Then test another login on a different terminal to verify it's still working.

Try running SSH over a different port, or even run a VPN and use telnet.Telnet is actually more secure in some ways than SSH contrary to popular belief (aside from the plaintext over network issue). Here's why:

With telnet, authentication is based on just 1 sequence of bytes with only 2 possible outcomes: it works or it doesn't work. This sequence of bytes passes across the TCP stream and straight into a tty. However, with an sshd the sequence of bytes passes off the network, through a very complex series of negotiation steps and then directly into the authentication system. All the 1000s of lines of code that handle authentication in sshd with all the various different buffers and branches leads to a vastly increased probability of somewhere having a potential bug and thus exploits.

Greg Hoglund and Gary McGraw wrote in "Exploiting software: how to break code" about what they call the trinity of trouble - complexity, extensibility, and connectivity. SSH is one protocol that though nicely audited in the OpenSSH implementation has all 3. This is one reason why on trusted networks I personally always run telnet, and on untrusted networks I keep an eye out for any new exploits.
GarethNelson is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Share on FacebookStumble this Post!Google Bookmark this Post!Bookmark to Slashdot!
Reply With Quote
Old 06-23-2008, 10:40 AM   #4 (permalink)
net
Junior Member
 
Join Date: May 2008
Posts: 2
Default

Quote:
Originally Posted by GarethNelson View Post
This is one reason why on trusted networks I personally always run telnet, and on untrusted networks I keep an eye out for any new exploits.
That could work, although you can never be too cautious also on your trusted networks.
net is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Share on FacebookStumble this Post!Google Bookmark this Post!Bookmark to Slashdot!
Reply With Quote
Reply

Tags
harding, linux, no root login, sshd

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


All times are GMT -7. The time now is 06:47 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0