Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to change the permission of the folder "opt" and "usr". It is owned by root. I can't change the permissions at this moment because it's showing "You're not the owner, so you cannot change the permission".

I want to change permission of inside folders too. Is there any command for that please? I'm a newbie to Ubuntu and currently having 13.04

share|improve this question
8  
Don't do it. Changing permissions of these system folders will cripple your system. Search this site and find questions from people who did it and then couldn't change those permissions back easily. –  user68186 Jul 30 '13 at 11:26
8  
Changing Permissions is very Dangerous, unless you sure that what you do is correct, it's good idea to tells us why you will do that so we can help you more –  Yousef's Jul 30 '13 at 11:33
1  
Here, the real question is "why should you want do that?". Probably there is something horribly wrong in the steps preceding the need to ask such a (suicidal) question. –  Rmano Jan 8 at 21:34
    
This really looks like an XY Problem... you definitely should state what you're intending to do with this. –  GabrielF Jan 8 at 23:01
add comment

2 Answers 2

First thing I will say: Do not change the ownership of /opt or /usr. You will cause masses of problems. For instance, if you change the ownership of /usr from root, then sudo will no longer work properly (in fact, it could render the computer unbootable from what I have heard). Indeed, there's very little that's owned by root by default that I would ever advocate changing the ownership of - once you do something like that recursively it becomes incredibly difficult to undo it.

If you need to create a file within one of them, use sudo. So, if you had instructions to install a program under /opt, in a folder called /opt/myprogram that needed to belong to you, you would perform the following commands; cd /opt; sudo mkdir myprogram; sudo chown $USER myprogram.

But as I say, for the sake of your system's stability, ONLY change the ownership on files or folders you yourself have created. If you need to edit something owned by root, use sudo ahead of the command rather than taking ownership.

share|improve this answer
    
Even though this doesn't answer the question, it is the best answer. You should add a howto though, even if you shouldn't do it. –  Mew Jan 3 at 3:47
2  
@pacificfils, no, don't ask for a "howto break your system". –  guntbert Jan 4 at 12:58
    
@Guntbert i am aware of that. I have done that once before in my Linux infancy. –  Mew Jan 4 at 18:57
    
@pacificfils In principle I agree, I generally dislike answers along the lines of "Why would you want to do that? That's wrong, don't do that. Do this instead" since usually they're ignoring something unsaid that the asker wants to do. But what Espero wanted to do here was a very dangerous of going about things. Technically the last step of my suggestion (workaround for what he probably wanted to do) could be used to do this, but I didn't want to explicitly state a possibly system-bricking command (/opt isn't as dangerous as /usr, but still...) –  Jez W Jan 15 at 12:26
add comment

If your user is in the sudoers list (/etc/sudoers) you can use sudo before the command.
$sudo chmod 777 /root/opt

Similarly you can use chown command to change the owner of a file.

But it is not recommended to grant access to anything inside /root to users other than root. Be careful!

share|improve this answer
4  
Never suggest giving 777 to any directory without proper explanation and warnings. –  guntbert Jan 4 at 12:59
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.