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 would like the user to have full rights on this folder (as well as all sub-directories and files in it):

~/.blabla

currently owned by root.

I have found numerous posts (in this forum and elsewhere) on how to do this for files but I can't find a way to do it for whole folders.

share|improve this question
2  
Could anyone add a graphical method I wonder? –  8128 Oct 13 '10 at 19:23
1  
@fluteflute is there a graphical method? –  Marco Ceppi Oct 13 '10 at 19:33
1  
gksu nautilus perhaps. I'm not quite sure and would like to know.... ;) –  8128 Oct 13 '10 at 19:39

6 Answers 6

up vote 106 down vote accepted

Use chown to change ownership and chmod to change rights.

As Paweł Karpiński said, use the -R option to apply the rights for all files inside of a directory too.

Note that both these commands just work for directories too. The -R option makes them also change the permissions for all files and directories inside of the directory.

For example

sudo chown -R username:group directory

will change ownership (both user and group) of all files and directories inside of directory and directory itself.

sudo chown username:group directory

will only change the permission of the folder directory but will leave the files and folders inside the directory alone.

As enzotib mentioned, you need to use sudo to change the ownership from root to yourself.

Edit:

Note that if you use chown user: file (Note the left-out group), it will use the default group for that user.

share|improve this answer
1  
It should be said that "sudo" is required for chown. –  enzotib Oct 13 '10 at 9:45
    
fatanstic. You should consider maybe replacing 'user:user' by username. –  user2413 Oct 13 '10 at 9:48
    
Although I have changed the owner and group to Me and my group, I cannot edit the file acpi-support. Why? Thx. –  Casper Li Jan 26 at 5:48

If you prefer, this can be done with a GUI as well. You will need to open Nautilus as root to do so. Press Alt+F2 to access the "Run Applications" dialog and enter gksu nautilus

Next, browse to and right click on the folder you would like to modify. Then, select "Properties" from the context menu. You can now select the user or group that you would like to be the "Owner" of the folder as well as the permissions you would like to grant them. Finally, press "Apply Permissions to Enclosed Files" to apply the changes recursively.

Though it seems this does not always work for some operations in a deep folder tree. If it does not work use the appropriate terminal command.

alt text

share|improve this answer

Make the current user own everything inside the folder (and the folder itself).

chown $USER -R ~/.blabla
share|improve this answer
1  
very helpful for newbies (like me) when don't know what to type in 'usergroup' for sudo chown <your username>:<your usergroup> -R <path to>/.blabla –  quantme Jan 5 '12 at 1:49

If it's owned by root you can do this

sudo chown <your username>:<your usergroup> -R <path to>/.blabla

Since ./blabla owned by root you need to gain root privileges to change that. That's what sudo will do. The -R option for the chown command says: this directory and everything in it recursively.

share|improve this answer
    
what is /.blabla??? –  Zeynel Dec 17 '13 at 23:47
    
Just a sample file name. –  Anurag May 14 at 20:24

you should try chmod -R

share|improve this answer

First you have to create a root password

Type in terminal without brackets sudo passwd root

Enter your normal password press enter

It ask for a new unix password type in a new root pass word when ask (it will ask twice)

Type clear enter

Type su now enter your new root pass word here (the terminal is now root denoted by the # sign)

Now type in nautilus to start up the unix explorer window

Navigate to your desired folder and right click on it click the permissions tab and change accordingly when done close window and type < exit > to leave root terminal and close terminal.

share|improve this answer
2  
There are very few reasons to give the root account a password and this certainly is not a good reason. Press alt-F2 and gksu nautilus instead –  Warren Hill Feb 7 '13 at 15:05
2  
Not to mention that to get exactly the effect you were after, you could have just typed sudo su and used your regular account password. That way you avoid giving a password to the root account, and can still have a terminal open as root. –  Jez W Jun 24 '13 at 14:57

protected by Community Feb 21 at 7:21

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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