Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
05-24-2006, 09:44 AM
|
#1
|
LQ Newbie
Registered: Mar 2006
Posts: 29
Rep:
|
illegal ssh login attempt killing me
hello there!
I'm new in linux.
I'm using slackware 8.0 for my mail server. for the last few months i'm facing huge illegal ssh login attempt in my server. I can't stop the ssh service cause i need it. but i want to allow some specific IPs only from where the ssh login can be done. from all other IP ssh will be denied. how to do it? can anyone please help me out?
|
|
|
05-24-2006, 09:56 AM
|
#2
|
Member
Registered: May 2004
Location: Iowa USA
Distribution: CentOS
Posts: 419
Rep:
|
You could move your SSH port to something other than 22, for starters. In your sshd config file (on my systems it's /etc/ssh/sshd_config) you will want these entries:
Code:
Port 8945 # or something beside 22
Protocol 2
To allow logins only from specific IPs, you can add this to sshd_config:
Code:
AllowUsers *@1.2.3.4
That will only allow SSH logins from any user from IP address 1.2.3.4.
You can lock it down even tighter by disallowing direct root logins, and specifying a user in the line above. For example, create a user "ridwan77", add them to the group wheel, and include this in your sshd_config file:
Code:
AllowUsers ridwan77@1.2.3.4
PermitRootLogin no
In this case, only ridwan77 will be allowed to login, and then only from IP address 1.2.3.4. You can include netblocks in the AllowUser with
Code:
AllowUsers ridwan77@1.2.3.*
You will have to restart sshd to make any changes effective. Restarting sshd will not kill your current session.
|
|
|
05-24-2006, 10:21 AM
|
#3
|
Member
Registered: May 2005
Location: Northern VA
Distribution: Slackware, Ubuntu, FreeBSD, OpenBSD, OS X
Posts: 782
Rep: 
|
Since you're new to Linux and are using an older version of Slackware, you might want to upgrade your SSH package (if you haven't already).
|
|
|
05-27-2006, 12:53 AM
|
#4
|
LQ Newbie
Registered: Mar 2006
Posts: 29
Original Poster
Rep:
|
Dear zaichik,
Thanks for your quick reply.
You said "For example, create a user "ridwan77", add them to the group wheel, and include this in your sshd_config file" .... I'm confused about adding to the group wheel. how to do that please describe
-Ridwan
|
|
|
05-27-2006, 12:58 AM
|
#5
|
Member
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567
Rep:
|
|
|
|
05-27-2006, 07:18 AM
|
#6
|
LQ Newbie
Registered: Mar 2006
Posts: 29
Original Poster
Rep:
|
hello zaichik,
I have added the following lines in my /etc/ssh/sshd_config file:
AllowUsers ridwan77@192.168.222.*
PermitRootLogin no
and then i killed the sshd daemon and start it again. but i can't login and the log is showing the following messages:
May 27 18:07:01 mail sshd[612]: input_userauth_request: illegal user ridwan77
May 27 18:07:01 mail sshd[612]: Failed none for illegal user ridwan77 from 192.1
68.222.10 port 2232 ssh2
May 27 18:07:01 mail sshd[612]: Failed keyboard-interactive for illegal user rid
wan77 from 192.168.222.10 port 2232 ssh2
May 27 18:07:09 mail sshd[612]: Failed password for illegal user ridwan77 from 1
92.168.222.10 port 2232 ssh2
would u please tell me what to do now ?
- Ridwan
|
|
|
05-27-2006, 11:00 AM
|
#7
|
Member
Registered: May 2004
Location: Iowa USA
Distribution: CentOS
Posts: 419
Rep:
|
Did you add the Unix user ridwan77?
Code:
useradd ridwan77
passwd ridwan77
and then enter a good, secure password for the user (at least 10 characters, combination of upper- and lower-case letters, numerals, and special characters).
Don't forget to add the user to wheel. Edit /etc/group, and the line that says something like (probably)
change to
Code:
wheel:x:10:root,ridwan77
No spaces on either side of that comma there.
|
|
|
05-28-2006, 08:22 PM
|
#8
|
Member
Registered: Jun 2003
Location: Batam
Distribution: Ubuntu 10 And Linux Mint
Posts: 414
Rep:
|
Why not using an iptables to prevent it ???
|
|
|
05-30-2006, 02:20 AM
|
#9
|
LQ Newbie
Registered: Mar 2006
Posts: 29
Original Poster
Rep:
|
hi zaichik,
At last it worked. Thanks for your assistance
Ridwan
|
|
|
05-30-2006, 03:27 AM
|
#10
|
Member
Registered: Mar 2005
Location: Chicago
Distribution: Gentoo AMD64
Posts: 365
Rep:
|
Since you don't always know the IPs of the machines you'll be using to log in to your server, I think using iptables to limit connection attempts is a better solution, it's not very difficult. Here is a link explaining how:
http://www.tummy.com/journals/entrie...0050724_172920
|
|
|
All times are GMT -5. The time now is 07:09 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|