How to restrict root user from running some commands

is it possible that we can restrict the root user if he runs some commands?? e.g i want if root runs command 'rm etc/passwd', he shoudn't be able to run command and throws error :confused:

Ok,
Normally you can't limit the root user. Some distros, like Ubuntu, disable root and make you use sudo instead. You can limit what a user does when they use sudo. Solaris 10 using RBAC can limit root by making it a role, but I don't think your asking about that. If I where you I would not mess with the root account.

If you want to get creative, you could just write wrapper scripts for the commands that you don't want root to run or have limited access too. I've actually done this at a previous workplace that insisted on allowing others (besides me) to have root access on some shared systems. I wrote a wrapper for the rm command and put all types of checks and balances as well as logging into it (there was an issue of data being deleted as the root user and no one fessing up).

This way you can avoid messing with the root account itself as bitlord said.

Just a thought.

Good luck.

Please post the exact Operating System and version in question and mention whether it has been installed as a "secure" or even "Government restricted" version of unix.

It is possible on some "secure" unix O/S to restrict the root account for whatever reason but it will give you much grief in a Disaster Recovery situation without some serious design of your backup strategy. In the end some user will need to be able to read all the data from a backup ... and it might as well be "root".