Tell me more ×
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? – fluteflute 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.... ;) – fluteflute Oct 13 '10 at 19:39

6 Answers

up vote 40 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.

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

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
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

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
1  
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 at 15:05

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.