Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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:

  1. Change the group ownership of the directory, give the group write privileges, and add the user to that group.
  2. Do the install as root. Correct permissions post-install.
  3. Make the directory world-writable.
  4. 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).

share|improve this answer
    
Thanks. The install instructions say anyone can install the software, including root, or non-root users. Is root typically expected to install most software? –  gkdsp Feb 7 '12 at 4:21
    
System-wide software should always be installed by root (absent good reasons not to). If you wish to install Glassfish as a non-root user you must install it to a directory your user can write to. –  voretaq7 Feb 7 '12 at 4:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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