Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Disabling certain things for users
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
AimarPL
n00b
n00b


Joined: 25 Oct 2008
Posts: 9
Location: .pl

PostPosted: Sat Jan 09, 2010 9:55 am    Post subject: Disabling certain things for users Reply with quote

Hi there,
I'm wondering how can I disable certain commands for users like for example I can do with cron by adding or removing user from group using gpasswd -a user cron ... how do I disable user from using "ps" command? or gcc compiler...?

Thanks in advance for any kind help :)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54821
Location: 56N 3W

PostPosted: Sat Jan 09, 2010 10:58 am    Post subject: Reply with quote

AimarPL,

To take commands away from all users change the permissions/ownweship on the binaries to 750 root:root.
You can make a group called say, expert that you trust and change the settings to 750 root:expert
Add the trusted users to the expert group and they can use the commands.

You might also consider mounting /home and /tmp with the noexec option. This prevents programs that are in those filesystems from being executed. It also requires that /home and /tmp be seperate filesystems. I've not fully thought that through. It may interfere with normal system operation, since root can't execute things there either.

Longer term, you cannot stop users uploading a gcc that runs in their home, so think through your approach to security.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23082

PostPosted: Sat Jan 09, 2010 5:15 pm    Post subject: Reply with quote

Mounting /tmp with noexec works fine on most systems. I have done it for years on a variety of systems with no problems. Mounting /home with noexec is a bit more system-specific. If you have users who have a legitimate need to develop programs, or if you build kernels using the KBUILD_OUTPUT support and store the objects under /home, you may break legitimate usage by mounting /home with noexec.
Back to top
View user's profile Send private message
wthrowe
Tux's lil' helper
Tux's lil' helper


Joined: 19 Aug 2009
Posts: 141

PostPosted: Sun Jan 10, 2010 12:30 am    Post subject: Reply with quote

To actually prevent users from running arbitrary binaries, you need to make sure every writeable directory on the system is noexec. /var/tmp and /var/cache/fonts come to mind, in addition to /home and /tmp. This could impact some legitimate programs (a default configuration of portage, for example).

Preventing particular programs from being run is pointless from a security point of view unless you close all these holes, since users could always copy the binaries over from another machine. gcc probably doesn't even have to be run on the local machine to cause you worry.

Even if you manage to prevent users from executing their own binaries, you probably can't prevent them from running scripts. I suspect perl < foo.pl would work even on a noexec filesystem.

As regards ps, I believe there is a grsecurity kernel option that will only let users see their own processes. You should consider using a hardened profile and kernel and read the Gentoo docs on hardened. See various pages linked from http://www.gentoo.org/doc/.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum