LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 02-17-2010, 01:59 PM   #1
replica88
Member
 
Registered: Nov 2009
Posts: 48

Rep: Reputation: 18
Only allow root ssh access to the server


When creating 10 samba users I also created Linux users. I do not want these Samba users to be able to use putty, winscp etc to access the server.

Do you know how I can restrict ssh access to specific users?
 
Old 02-17-2010, 02:01 PM   #2
Web31337
Member
 
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
DenyUsers? or, better AllowUsers?
man sshd_config
Anyway, why would you need root access to ssh? isn't it better to allow one user to access ssh and then use sudo/su when need root access?
 
Old 02-17-2010, 02:46 PM   #3
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Alternatively (or additionally), you could give the samba users nologin shells.

# chsh -s /sbin/nologin user_here

I don't use samba, but I don't see why a valid shell would be required. (However, if I am mistaken, then my advice is wrong. )
 
Old 02-19-2010, 05:30 AM   #4
deadeyes
Member
 
Registered: Aug 2006
Posts: 609

Rep: Reputation: 79
Quote:
Originally Posted by anomie View Post
Alternatively (or additionally), you could give the samba users nologin shells.

# chsh -s /sbin/nologin user_here

I don't use samba, but I don't see why a valid shell would be required. (However, if I am mistaken, then my advice is wrong. )
This is the way to go if your concerns are the samba users only.
If you dont want any other user then root, use Allow/DenyUsers

Also, when you create a samba user, it does need a system user.
BUT (and this is important to know) you do not need to set a password on the system user account.
This automatically does deny ssh access as empty password logins are denied by ssh.
 
Old 02-19-2010, 06:46 AM   #5
cantab
Member
 
Registered: Oct 2009
Location: England
Distribution: Kubuntu, Ubuntu, Debian, Proxmox.
Posts: 553

Rep: Reputation: 115Reputation: 115
Bear in mind setting the shell to nologin does not prevent non-shell ssh access, like portforwarding. And there's a nice little DoS using that. To block ALL types of ssh access, you need to use Allow/Deny users

And you should not allow root ssh logins. If you allow root logins, an attacker need only guess the root password. You should allow a user to login to ssh, and then su to root. And make the root password different to the user's password. That way, an attacker has to guess a username, a user password, and a root password.
 
Old 02-20-2010, 04:48 AM   #6
deadeyes
Member
 
Registered: Aug 2006
Posts: 609

Rep: Reputation: 79
Quote:
Originally Posted by cantab View Post
Bear in mind setting the shell to nologin does not prevent non-shell ssh access, like portforwarding. And there's a nice little DoS using that. To block ALL types of ssh access, you need to use Allow/Deny users

And you should not allow root ssh logins. If you allow root logins, an attacker need only guess the root password. You should allow a user to login to ssh, and then su to root. And make the root password different to the user's password. That way, an attacker has to guess a username, a user password, and a root password.
Yes, forgot to mention the non shell ssh access (-N option). Good you mentioned that!
 
Old 02-20-2010, 08:36 AM   #7
replica88
Member
 
Registered: Nov 2009
Posts: 48

Original Poster
Rep: Reputation: 18
Thanks guys, good advice. I've changed my approach, now only one user account has ssh access and has to su to root.
 
  


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
Access to one server via root/ssh/ftp on other only ftp anthonychallis Linux - Newbie 4 01-12-2010 02:23 PM
SSH access problems: Can only allow users SSH access by adding to root group dhupke Slackware 10 12-21-2008 09:48 AM
Using DSL and ssh / ssh-server to access the Windoze desktop GUI On2ndThought Linux - Server 4 11-16-2008 02:17 PM
root access using SSH atrac Linux - Security 2 10-29-2007 10:05 PM
SSH Root Access DediPlace Linux - Security 6 05-29-2005 11:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

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

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