There is a common file which is accessed by both root and user.i want to change that file from user mode and that should not effect root and viceversa. how to do this in RHEL6?

  • 1
    Have you tried setting and ACL on the file? setfacl -m u:<userName>:rw replacing <userName> with the user you're targeting. – Bratchley Jun 6 '13 at 10:45
  • @JoelDavis No that i didn't try. i have two desktops like gnome.desktop and custom.desktop, now i want to allow gnome.desktop only in root mode and not in user mode. similarly i want to allow custom.desktop in user mode and not in root mode.when i am changing custom.desktop or gnome.desktop it gets affected in both modes. that is the problem i am facing. – subbarao Jun 6 '13 at 11:25
  • Unless you do something with pam_cap to lock root out of CAP_DAC_OVERRIDE (which wouldn't be advisable), root can (by design) do whatever it wants. root is the failsafe account you're supposed to use to back yourself out of any precarious position you accidentally put yourself in. – Bratchley Jun 6 '13 at 11:37

sudo does the job for me .

Just prefix sudo before the command .For example to change access type

     sudo chmod +x filename 

It sounds like you want different users to see different contents for the same file. This is not possible.

(It is possible to let different sets of processes see different contents for the same file. But this takes a lot of effort to set up.)

Many applications look for a configuration file in the user's home directory. This is the usual way to obtain different behavior for different users. Failing that, you might use environment variables or command line options.

If you're having trouble doing something, ask how to do it. Don't rush into some oddball solution and ask for help implementing it. You're suffering from the XY problem. Ask about your ultimate goal, not about a dubious intermediate step.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.