Is there a command that allows a user to temporarily have root permissions but files and directories created by the user still reflects the user rather than root?
For example, I have a user that needs to install some software (Glassfish), but the self-extracting installer returns an error "permission denied". Is there a way to give the user higher permissions to run the installer such that when the installer creates directories and files they are owned by the user doing the installation (rather than root)?
Is this even possible?
Answer
Generally speaking: No. There are a few ways to achieve the end result you're looking for though.
Basically Your installer needs to write to a directory that your user cannot write to, your options for achieving this (at a quick glance) are:
- Change the group ownership of the directory, give the group write privileges, and add the user to that group.
- Do the install as root. Correct permissions post-install.
- Make the directory world-writable.
- Set appropriate ACLs on the directory (Google
Linux filesystem ACLs
for more info)
Pretty much all of this requires that you be root - and the best solution is probably to install this software as root the way the designers intended unless you have a really good reason not to (among other things, having the installed files owned by root prevents malicious code running as the user modifying the installed software later).
No comments:
Post a Comment