How to prevent su to root?
I've installed sudo and sudoscripting on my RHEL AS3 implementation. I would now like to prevent everyone from su"ing" to the root user. I'd prefer that all use the "ss -u root" command as it will provide a much better audit trail. Can anyone point me in the direction of how I can prevent su to root. Thanks.
|
Take a look here, maybe you'll find something that will help.
|
Reddazz, I already read that (that's RHL 9 workstation security). The info is good, but I'm just tring to lock down "su -". Have yet to come across a simple way to do it. thx.
|
Moderator note: This thread will probably get more exposure in the Linux-Security forum. Moving thread there.
|
Try
chgrp wheel /bin/su chmod 4750 /bin/su chmod +s /bin/su Now the only people who will be allowed to 'su' to root must be part of the wheel group. Just make sure the people you want to be part of the wheel group are part of that group first, otherwise you may not be able yourself to 'su' to root after this to add them to it. Plus you can add this to the /root/.bashrc file and this will email you if someone manages to 'su' to root or login as root: ALERT - Root Shell Access (ServerName) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d"(" -f2 | cut -d")" -f1`" you@youraddress.com Apparentely this can be bypassed through ssh if they use: ssh user@example.com /bin/bash --noprofile --norc But if add the line to /root/.ssh/rc file (might need to create it first)it is apparentely read before they have actually logged in, I haven't had a chance to verify this just yet |
Thats exactly what the article I linked to was suggesting but jwholey said it wasn't helpful. This is the way its done in FreeBSD. You cannot use su unless you are part of the wheel group.
|
Quote:
I didn't read your link till now, but I have seen that page in the past. The only way then to lock it down quickly and simply would be to change the permissions and groups. That is why FreeBSD and all the other unix are very secure and stable. |
Quote:
|
That's why I writing my own hardening script for linux, it will have all the tips and tricks I can find to help make it as secure as possible.
|
hope tis helps:
http://www.puschitz.com/SecuringLinu...SharedAccounts |
Quote:
Thanks for the link , that has some fantastic tips. :study: |
Is there any reason you can't just chmod -x /bin/su? If you want to prevent everyone from using that command, would that work or is there some other problems this would cause that I'm not aware of? I would like to know, just out of curiosity.
|
Quote:
That will only stop them from executing it, but through the permissions some users will still be able to have access to the file. Plus it's not a good idea to restrict all users and not allow atleast one user from being able to 'su' to root. If you have secured the machine properly and disallow root to login from console, remote, SSH and GUI(KDM and GDM) then you will never be able to administer the system or add software to it, basically locked root out for good. |
What about using /etc/suauth?
To shut everyone out, use: ALL:ALL:DENY Or to make it like BSD and only allow members of the wheel group: ALL:ALL EXCEPT GROUP wheel:DENY Then you may want to (as root) chmod 600 /etc/suauth for safety. Hope this helps. Edit: 'man suauth' for more info. |
Reply
Add yourself to the root/wheel group and go into /etc/pam.d/su and uncomment out:
auth required pam_wheel.so Before you log out of the root open another terminal and login as a regular user and try to su. If you can it worked. If not since you're still root in another shell go in and fix it. Also I would recommend going into /etc/securetty and deleting all the contents. This will block root from logging in directly on your machine. Then go into /etc/sshd_config and change permitrootlogin to no. This will stop someone from logging in remotely as root. I also recommend changing the protocol to 2 only. Now the only way to be root is by su from an account in the wheel/root group. PAM won't be affected go apps that prompt for a root password like kuser and such will still prompt you for the root password. Get bastille as well to lock down your system. |
All times are GMT -5. The time now is 09:46 AM. |