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.

Ederico
  • 5,997
  • 8
  • 26
  • 24
  • Did you compare the right and owners and group directories which you have access and those which you do not have access (ls-l) ? – Franck Charpentier Jul 25 '13 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 – Rodislav Moldovan Jul 25 '13 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 '13 at 16:55
  • @Rodislav, I did that (once again), to no avail. – Ederico Jul 25 '13 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 '13 at 17:08
  • By the way, I cannot seem to change permissions through nautilus either, even though I as a user am marked as the folder/file owner. – Ederico Jul 25 '13 at 17:23
  • Update: I copied folder back to the original drive from which I had copied it, and tried to access it and its contents using my iPad and the relevant app and hardware. It worked. Permissions are identical to ones above when using ls -l. So, I am no expert judge on these things, but perhaps the problem is the drive I backed the data too. This one: http://www.expertreviews.co.uk/external-hard-drives/1293754/seagate-backup-plus-desktop-3tb – Ederico Jul 25 '13 at 17:42
  • You can try using GParted to simply copy the entire partition from your old drive to the new one. GParted is free from the Software Center. To copy the partition, open GParted, delete the data partition on the new device, copy the data partition from the old device, and paste it to the unallocated space on the new device. The data itself will be copied raw, permissions and all. Avoid mounting the new device in Ubuntu, but connect it to your MediaShare and see if it works. Delete everything you don't need if it does. – Richard Jul 25 '13 at 21:46
  • Actually I would rather avoid the GParted route, as I found a work around. Copying the files from the problematic folders to new folders on the same device solves the problem! The strange thing (to me) is that using ls -l gives the same results for all the folders and files, as displayed in a previous post above. At this point, it might be a problem with the iOS app for the device rather than an ownership/permissions issue as I thought at first. – Ederico Jul 26 '13 at 05:41
  • I have to clarify myself, I copy the files to an internal HDD on my Ubuntu system, then paste them to the same device, and they work. – Ederico Jul 26 '13 at 06:27
  • have you tried to performa chmod as root ? – Rodislav Moldovan Jul 26 '13 at 08:48
  • Wait, you copied a problematic folder from the external HDD to your internal HDD, and then copied it back (assuming you gave it a different name, to avoid the duplication) to the same parent folder, and it became accessible through the iPad? And `ls -l` shows the same permissions? As in, the same `drwx------ 1 ederico ederico 0 mag 21 2010 Lucio Battisti` for example? Same owner, same permission bits? Can you do `chmod o+rwx "Lucio Battisti" && chmod o+rw "Lucio Battisti/LUCIO_BATTISTI_Password_Discografia_completa_Lucio_battisti_1960_-2004__30_cd.t‌​xt"` on that problematic folder, and try? – Alaa Ali Jul 28 '13 at 08:38

2 Answers2

3

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.

Werne
  • 66
  • 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 '13 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 '13 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

SimplySimon
  • 4,785
  • 8
  • 34
  • 52