you should be able to restrict users from using certain commands by using file permissions on the commands themselves
Code:
[root@www ~]# which top
/usr/bin/top
[root@www ~]# ls -al /usr/bin/top
-r-xr-xr-x 1 root root 53944 Jul 11 2005 /usr/bin/top
[root@www ~]#
Quote:After the first -, there are 9 characters defining the file permissions. These permissions aregiven in groups of 3 each. The first 3 characters are the permissions for
the owner of the file or directory. The next 3 are permissions for the
group that the file is owned by and the final 3 characters define the
access permissions for everyone not part of the group. There are 3
possible attributes that make up file access permissions.
r - Read permission. Whether the file may be read. In the case of a
directory, this would mean the ability to list the contents of the
directory.
w - Write permission. Whether the file may be written to or modified. For
a directory, this defines whether you can make any changes to the contents
of the directory. If write permission is not set then you will not be able
to delete, rename or create a file.
x - Execute permission. Whether the file may be executed. In the case of a
directory, this attribute decides whether you have permission to enter,
run a search through that directory or execute some program from that
directory.
borrowed from
[/url][url=http://www.freeos.com/articles/3127/]http://www.freeos.com/articles/3127/ - understanding linux file permissions
right, in the above example the permissions for top are
-r-xr-xr-x
so you can see that 'top' is given executable permissions by owner, group and users,
if you use chmod to change the permissions on this file you could for example only allow 'root' access to execute the 'top' command.
remember,
Quote:the final 3 characters define theaccess permissions for everyone not part of the group
so you can see that in the 'top' example the last three characters are listed as 'r-x' which is the ability to
read and execute
so, if you remove the ability to 'execute' for 'users' then only root, and members of root's group can execute the command 'top'
have a look at the below example
Code:
[root@www ~]# chmod 550 /usr/bin/top
[root@www ~]# ls -al /usr/bin/top
-r-xr-x--- 1 root root 53944 Jul 11 2005 /usr/bin/top
now, the 'execute' and for that matter 'read' attribute for 'top' have been removed from non-root users, and that means that non-root users
1. will not be able to read 'top'
2. will not be able to execute 'top'
unless they login as root
i'm not going into too much detail here but hopefully this will give you an idea of one way of achieving your goal, if you want more details then let us know
cheers
anyweb