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.

Not being an expert in Linux/Ubuntu, I had to install from scratch today and messed up w/file permissions.

The thing is that, when backing everything up before reinstalling, a couple of important documents couldn't be copied to the external drive, so I used gksudo nautilus to be able to.

Now I've copied them back and I can't use them. They are locked, a lock icon appears on a corner and the original error message shows again.

Is there a graphical/easy way to set file permissions back to normal?

I've read about chmod fchmod and chown and I would like to avoid them if possible. If there's no choice, can any of you please give me a quick example on how to use it?

Thank you so much Ub. Community!

share|improve this question
    
chmod +rw file.txt and chown gcwilkins:gcwilkins file.txt –  Anonymous Nov 1 '11 at 23:55
1  
@GCWilkins Welcome to AskUbuntu! If your question has been resolved, can you mark it as such by accepting the answer below you found most helpful rather than by making an edit? You can do so by clicking the checkmark icon next to the desired answer. Thanks! –  Christopher Kyle Horton Nov 2 '11 at 0:56
    
Sorry, I'll have a look at the forum rules & procedures when I have a min! –  GCWilkins Nov 2 '11 at 1:23

3 Answers 3

up vote 2 down vote accepted

To chmod on many files at a time just use the -R thingy to do it recursively(subfolders, files etc).

So if I am in folder /myfolder and I want to make all files/subfiles/folders/subfolders in there to belong to me and have all accesses I would do:

chmod -R 770 *
chown -R myname:myname *

So just replace myname with your name in Ubuntu. You don't need to change anything in the first one.

share|improve this answer
    
Thanks! I SOLVED it using your lines for the sake of terminal economy...! –  GCWilkins Nov 2 '11 at 0:46

Right-click on the file, select 'Properties' in the context menu, then chose the 'Permissions' tab. This allows you to set permissions within Nautilus.

If you run Nautilus as superuser (sudo nautilus) then you can also change owner of the file.

share|improve this answer
    
I already realized that on my own, but thank you very much! Now I wonder if there is a way of doing that or applying chmod to a bunch of files and directories at the same time. –  GCWilkins Nov 2 '11 at 0:14
    
Just select a bunch of files and right-click and select Properties and do the same. Or you right-click on a folder, and select Properties, then Permissions then press the "Apply Permissions to Enclosed Files" button. –  Anonymous Nov 8 '11 at 19:56

No click and point method springs to mind. Here's the command line method (type these in to a terminal):

# set up some variables: userid to hold the UID and group to hold the GID
userid=$(id -u)
group=$(id -g)
sudo chown ${userid}:${group} <file> ...
chmod 600 <file> ...

This code first grabs your userid and group (see man id), then changes the file(s) ownership(s) to you (see man chown). This has to be done as root (see man sudo) because we don't know the current ownership. Then, when the files(s) belong to you, we change the permissions to Owner:read/write,Group:,Other:. If the is a directory (folder) change the last line to

chmod 700 <file> ...
share|improve this answer
    
Thank you very much! I now understand file permissions and chmod/chown better! –  GCWilkins Nov 2 '11 at 0:45

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.