LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 03-23-2003, 06:37 PM   #1
Itzac
Member
 
Registered: Feb 2003
Distribution: VectorLinux 5.1
Posts: 116

Rep: Reputation: 15
Prevent users from running su


I want to prevent some users from running su, but not others. I've tried editing my sudoers file, so now, said users can't do
% sudo su

but just
% su

still works.

Any thoughts would be appreciated.

Thanks
 
Old 03-23-2003, 07:03 PM   #2
cuckoopint
Member
 
Registered: Feb 2003
Distribution: Debian
Posts: 797

Rep: Reputation: 30
umm, can't you just chmod su so only root can execute it?
 
Old 03-23-2003, 07:05 PM   #3
Itzac
Member
 
Registered: Feb 2003
Distribution: VectorLinux 5.1
Posts: 116

Original Poster
Rep: Reputation: 15
I suppose that would be a simple fix. I'll give it a shot. I'll guess then I'll just have to
% sudo su

Thanks
 
Old 03-23-2003, 07:12 PM   #4
Itzac
Member
 
Registered: Feb 2003
Distribution: VectorLinux 5.1
Posts: 116

Original Poster
Rep: Reputation: 15
I was about to do what you suggested when I noticed the following:
Code:
% ll su
-rwsr-xr-x  1 root  root  19132 Aug 29 2002 su
% chmod 744 su
% ll su
-rwxr--r--  1 root  root  19132 Aug 29 2002 su
My question is how do I do this and keep the s-flag (which I assume means secure, or such)?
 
Old 03-23-2003, 07:29 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Look in your /etc/pam.d for a file called "su". Now read up on the pam_listfile module.
 
Old 03-23-2003, 07:45 PM   #6
cuckoopint
Member
 
Registered: Feb 2003
Distribution: Debian
Posts: 797

Rep: Reputation: 30
Quote:
My question is how do I do this and keep the s-flag (which I assume means secure, or such)?
s means the command is suid/gid
see the manpage...but since you want others to execute, you still probably want it.

Quote:
The first digit selects the set user ID
(4) and set group ID (2) and sticky (1) attributes.
 
Old 03-23-2003, 07:53 PM   #7
cuckoopint
Member
 
Registered: Feb 2003
Distribution: Debian
Posts: 797

Rep: Reputation: 30
unSpawn is right though, if Pam can control that, go and use that (assuming you have Pam...)
 
Old 03-23-2003, 09:21 PM   #8
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
hehe I'm going to tell you another way to do it even though I am at risk of getting stoned to death for it. This is 'old-school' and most people have a problem with it.

What you do is create a group, usually called 'wheel', and add all the users you want to have access to the su command to the wheel group. Then chgrp su to the wheel group and chmod su so that only the owner and group have execute privelages.
 
Old 03-23-2003, 09:38 PM   #9
Itzac
Member
 
Registered: Feb 2003
Distribution: VectorLinux 5.1
Posts: 116

Original Poster
Rep: Reputation: 15
Thanks all, these all seem like good solutions. I was able to correctly chmod su, but it kinda opened a bigger whole, because now, I can just do sudo su without having to enter any password at all. I'll try messing around with pam.d/su

Thanks
 
Old 03-23-2003, 09:39 PM   #10
cuckoopint
Member
 
Registered: Feb 2003
Distribution: Debian
Posts: 797

Rep: Reputation: 30
its not 'old school'. Its the terrible, terrible way.

sudo has eliminated the need for a wheel group, and I still am to hear of a good argument for it.

btw, how does your suggestion differ from my 'sudo + chmod' suggestion (except for the fact that it uses sudo instad of a wheel group)?
 
Old 03-24-2003, 12:39 AM   #11
Itzac
Member
 
Registered: Feb 2003
Distribution: VectorLinux 5.1
Posts: 116

Original Poster
Rep: Reputation: 15
Not to get too far off topic, but I don't really see what's so bad about a wheel group.

Admins get a certain amount of privilege that users don't. It's the way it works. Although I've only been on university networks mostly. It keeps a few bad apples from destroying the network and preventing other students from doing work. And I don't really need to be running most of those commands myself, anyway.

Then there's the argument of too many cooks in the kitchen...

Anyhoo, later.
 
Old 03-24-2003, 06:54 AM   #12
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
Quote:
Originally posted by cuckoopint
its not 'old school'. Its the terrible, terrible way.

sudo has eliminated the need for a wheel group, and I still am to hear of a good argument for it.

btw, how does your suggestion differ from my 'sudo + chmod' suggestion (except for the fact that it uses sudo instad of a wheel group)?
I was simply just throwing another option out there for Itzac. If you are going to say that the technique I suggested is 'the terrible, terrible way' then you should tell us why you think it is so terrible. Not that I disagree with you but I'd like to here your thoughts on why it is so inferior to sudo.
 
Old 03-24-2003, 07:33 PM   #13
cuckoopint
Member
 
Registered: Feb 2003
Distribution: Debian
Posts: 797

Rep: Reputation: 30
Quote:
Not to get too far off topic, but I don't really see what's so bad about a wheel group.
<OT>
here's basically my problem with a wheel group:
there is an assumption that some people just need more power than others, and therefore get special privileges. The easiest example cited is a network admin. Now, I understand that people (except for root) may need some permissions that most can't.

The difference is sort of subtle. Wheel has some set of commands, etc. and allows everyone in the group to use them. With sudo, you can be more specific. The webmaster may need access to apache, etc. but has no need for backups, etc. While someone may be designated for software, backups - but really have no need for something else. Heck, you can have someone that is only responsible for booting, shutting down, etc. So sudo allows you to specify 'groups' - webmaster, backups, janitor - without worrying that the janitor will accidently screw with the cronjobs for backups, or redesign the webpage. Now, this is a very simplistic model, but hopefully you can spot the difference. Wheel assumes some people just need a bunch of permissions, sudo gives you everything you need to get the job done, and no more.

Hopefully this also answers Crashed_Again. True its a technique. But in my OPINION, its like running su, or just running everything as root - they're both techniques, right?
; )

cheers
 
Old 03-25-2003, 04:25 PM   #14
Itzac
Member
 
Registered: Feb 2003
Distribution: VectorLinux 5.1
Posts: 116

Original Poster
Rep: Reputation: 15
I guess what it comes down to then is that these are two means to one end. Sudo is just far more precise and refined than Wheel's rock-on-a-stick approach.

All's working reasonably well, now, btw.

Thanks,
 
  


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
FTP users prevent browsing to other directories mephesto Linux - Software 2 05-07-2005 10:03 AM
prevent users from running 'su' manudath Linux - Security 5 04-28-2005 02:03 PM
Can I prevent users from seeing dir contents? Jukas Linux - Newbie 5 04-08-2005 07:56 PM
How to prevent users from --> Drogo Linux - Software 7 01-31-2004 11:03 PM
prevent users from accessing KDE or GNOME cyberswami Linux - Security 6 01-24-2003 01:46 PM

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

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