5

I have an external drive on which I backed up data from another external drive using my Ubuntu 12.10 system. Now it would seem that there is a problem with folder and file permissions on the drive as I cannot access the files from another system (namely, my iPad through a Verbatim MediaShare Wireless device and the app for it).

Some folders do not show their contents at all (but the files are there thankfully, as they show up when I plug the drive to my Ubuntu system), other files cannot be opened.

This only happened after backed up the date on the external drive. The same data on the other external drive on which it was backed up was accessible with no problem at all. My logical conclusion, and I have to stress that my knowledge is limited here, is that the problem is with the ownership and permission settings.

I would like to make my external drive and the data on it, accessible to all (those that plug it in) so that I can access it on my iPad. Actually, I am also open to the idea of having the drive accessible to all with some folders accessible to all with read / write permissions and with others with only read permissions or with no accessibility at all. That is what would like to do and I am also open to your suggestions on security issues (i.e. making the setup more secure, as long as I can have access and read/write permissions on the drive while connected to my iPad). I am assuming that to do what I want I require accessibility available to all as well as read permissions, in the least.

12
  • Did you compare the right and owners and group directories which you have access and those which you do not have access (ls-l) ? Jul 25, 2013 at 14:32
  • I think it would be ok to change rights to 777 , read / write for everyone, using: chmod -R 777 /path/to/main/folder you should do this on a linux computer, expl: chmod does the change, 777 means - read write access to everyone, -R means -> do it recursively Jul 25, 2013 at 15:37
  • @FranckCharpentier, here is an example of what I get from one of the problematic folders when using ls -l, drwx------ 1 ederico ederico 0 mag 21 2010 Lucio Battisti -rw------- 1 ederico ederico 129755 mag 21 2010 LUCIO_BATTISTI_Password_Discografia_completa_Lucio_battisti_1960_-2004__30_cd.txt, ederico is my username.
    – Ederico
    Jul 25, 2013 at 16:55
  • @Rodislav, I did that (once again), to no avail.
    – Ederico
    Jul 25, 2013 at 17:01
  • @FranckCharpentier, define "access", frankly I cannot seem to truly access anything, some folders (such as the one) I used in my example above don't even show their contents on my iPad. For others, their content shows but the files do not open at all. This only happened after I backed up the data from one external drive to the other using nautilus on my Ubuntu 12.04, before that everything worked great.
    – Ederico
    Jul 25, 2013 at 17:08

2 Answers 2

3
+25

First, using chmod -R 777, which I see mentioned on every similar question, would make every document inside the main folder executable, and I doubt you need (or want) that. What you need is to change permissions for everyone else to have read-write access to the storage drive. That can also be achieved through chmod.

For example, the following file has read-write permission for the owner only and read-only access for the group, meaning I can't read or edit:

-rw-r-----  1 nobody users      4 Jul 24 20:26 file

There are four digits for chmod which can be combined to achieve a different result:

4 - read

2 - write

1 - execute

0 - nothing

And there are three digits that change file permissions for different things:

first digit - owner

second digit - group

third digit - everyone else

To make a file in question readable by anyone, while still retaining the original permission for the owner and group, I can execute this:

sudo chmod 646 file

That makes file read-write for owner (2+4), read-only for group (4) and read-write for anyone else (2+4). Now I can view and edit it, and ls -l now says the following:

-rw-r--rw-  1 nobody users      4 Jul 24 20:26 file

In case of applying that to the entire storage drive, you'd have to mount it, like so:

sudo mount /dev/sdX /path/to/mountpoint

Replace /dev/sdX with your external storage drive and /path/to/mountpoint with where you want the drive to be mounted (I usually make a directory in /mnt for that). You can also check which storage drive is the external one with:

sudo fdisk -l

So you don't chmod the wrong one. And then run

sudo chmod -R 646 /path/to/mountpoint

which will recursively change permissions for each and every file and folder on the mounted storage drive, allowing read/write access to the owner, read-only access to the group and read/write access to everyone else.

Put simply, chmod -R 646 will make all folders and files on the storage drive accessible, readable and editable by anyone on any PC and/or OS, while keeping default permissions for the file owner and group.

2
  • Good answer. Though, for completeness' sake, this doesn't really keep the current permissions for file owner and group; it explicitly sets them to 6 and 4, even if they were set to something else. If you want to only modify permissions for everyone else and keep owner and group permissions --whatever they currently are for every individual file-- intact, you should use sudo chmod -R o+rw. Chmod can be used like chmod [u|g|o][+|-][r|w|x] where u means user, g means group, and o means other. This modifies the permission bits for the specified category without altering the other ones.
    – Yamaho
    Jul 31, 2013 at 21:09
  • I forgot to say, another reason using it like chmod 646 is bad is that it strips execution permission from all files, something you might and might not want to do. Generally speaking, if you all you want to modify is one or two permission bits, it's really bad practice to use chmod [three digits] on an entire drive.
    – Yamaho
    Jul 31, 2013 at 21:17
1

The easy way is to:

  1. launch nautilus from terminal with sudo nautilus
  2. navigate to the root folder on the drive you want accessible by all
  3. Right click on the folder and select Properties from the bottom of the drop down list.
  4. In the window that opens, click on the permissions tab and then make sure that all the settings are as follows replacing simon with your group name

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .