Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible in linux to give a user read/write access to all files and directories like root?


EDIT I have a special case. I need to create a folder structure on which I can grand a special user full access independent of the underlying permissions. It's similar to a root user on one folder and it subfolders.

I'm not sure if this is possible and how to achieve that. I was reading on ACLs but I couldn't find a solution.

share|improve this question

migrated from stackoverflow.com May 25 '12 at 9:20

This question came from our site for professional and enthusiast programmers.

2  
No idea why you'd need to do this, but you can try adding the user to the root group. –  Blender May 25 '12 at 0:07
2  
I'm pretty sure this is not the right solution to your problem. I imagine you're actually looking for sudo. –  bkconrad May 25 '12 at 0:11
    
Maybe I have to clarify it a little bit: I only need read/write access to one file system. But I don't know how to achieve that without changing the permissions. It's not a question of why to do that. I would like to know if it's possible to consider to do it or not. –  multiholle May 25 '12 at 0:16
    
This sounds like an XY Problem (meta.stackexchange.com/questions/66377/what-is-the-xy-problem). We will be better able to help if you tell us what problem you are trying to solve, not just how you have decided to solve the problem. –  Dour High Arch Jun 3 '12 at 15:11

2 Answers 2

Granted I'm not a total expert in Linux, but this is a strange request.

Why would you want to do that? That is what Root permissions are for... and also that is pretty dangerous as said user could do pretty serious damage?

That being said, you could write a shell script that uses the command "chmod" to modify specific sets of folders. This way you could reuse the script...

share|improve this answer
1  
OP has mentioned in a comment that 'changing permissions' is not an option. Which, is plain strange. –  ArjunShankar May 25 '12 at 0:19
    
@ArjunShankar : Agreed. Linux is so graceful and helpful and useful at its file permissions system, it really is just a matter of understanding how it was set up and how it works, and therefore also how to layout your own directories and files so that you don't have to try and work against the system itself... –  hypervisor666 May 25 '12 at 0:26

Create new user:

adduser -u 0 -o -g 0 -G 0,1,2,3,4,6,10 -M nameofuser

Explanation:

  • adduser: command to add user in linux server
  • -u 0-o: a new user value set to 0
  • -g 0: set user group number to 0
  • -G 0,1,2,3,4,6,10: set user access to the group 0 = root, 1 = bin, daemon = 2, 3 = sys, adm = 4, 6 = disk, 10 = wheel
  • -M: do not create home directory for new user
  • nameofuser: a new username

Check whether the right of access and new information of new user like root user:

[root@centos ~]# id root
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
[root@centos ~]# id nameofuser
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
share|improve this answer
    
This would be the same as using root to access the files. Giving a user root right would create a big security hole. It needs some kind of scope to limit the access to some folders. –  multiholle Jun 4 '12 at 18:27

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.