1

I formatted the disk in my computer as ext4. Now I'm trying to make it readable and writable for any user on this computer. My entries in /etc/fstab look like this

# Data partitions
UUID=f59da30c-a2a8-4cab-97c6-4476453a3a31   /media/data1    ext4    defaults    0   0
UUID=73f1dad6-dcc4-4d12-996b-5e62406e7881   /media/data2    ext4    defaults    0   0

After mounting I also changed the owner of the mounted drives and gave rw permissions to every user as shown below. However other users still cannot write to that partition.

$ sudo mount -a 
$ sudo chown -R :users /media/data* 
$ sudo chmod -R g+rw /media/data* 
$ cd /media/data1/
$ touch test 
touch: cannot touch ‘test’: Permission denied


$ ll
total 20
drwxr-xr-x   5 root root  4096 Mär 18 19:13 ./
drwxr-xr-x  23 root root  4096 Mär 18 19:11 ../
drwxr-x---+  2 root root  4096 Dez 15 18:15 cvg/
drwxrwxr-x   2 cvg  users 4096 Mär 18 19:18 data1/
drwxrwxr-x   2 cvg  users 4096 Mär 18 19:18 data2/

(what is strange is that data1 and data2 are not highlighted green in bash after mounting, which was the case when I mounted patitions on other computers).

I already did this on another computer so I don't understand what I did wrong this time :(.

madneon
  • 1,983
  • 1
  • 13
  • 20
mcExchange
  • 3,088
  • 1
    First, on directories you need to also set the x bit, so chmod 770 . Second shared directories are not always so simple as new files will not have proper ownership / permissions. See http://askubuntu.com/questions/52584/shared-folders-for-all-users – Panther Mar 19 '15 at 13:11
  • Are the data1 and data2 partitions already mounted at /media/cvg/(UUID for data1) and /media/cvg/(UUID for data2)? The default when plugging a USB drive is to mount at media/username/UUID... I always mount to /srv for partitions I intend to share like this. This might be relevant. – Elder Geek Mar 19 '15 at 14:03

1 Answers1

3
  • Is current user in your group "users" ? Try groups command. If its not, than use sudo adduser USER-NAME users and then reload your session.
  • Isn't /media/data1/test file already there (owned by someone else)? Try ll /media/data1/test.
  • Are those partitions mounted without any restrictions? Try mount|grep /media/data command.

Mind to share outputs of these?

P.S. In your /etc/fstab you set last parameter to 0, meaning the drives wont be checked by fsck at system start when needed, are you OK with this?

madneon
  • 1,983
  • 1
  • 13
  • 20
  • Might be that my current user is not part of the "users" group. Although I cannot understand why? I tried creating users via terminal "adduser" and via gui "user accounts". In both cases there is no option to assign a group to a user. Anyway 1) here my output of groups: "MYCURRENTUSERNAME adm sudo lpadmin sambashare". 2) I'm setting up a new computer so there is definitely no file "test". 3) mount|grep /media/data gives /dev/sdb1 on /media/data1 type ext4 (rw) /dev/sdb2 on /media/data2 type ext4 (rw) 4) (PS) yes I fear that the check fails and thus my computer gets stuck while booting – mcExchange Mar 19 '15 at 13:32
  • You need to add 'your user' to group 'users' by sudo adduser YOUR-USER users, then you need to reload your session (logout and login again to desktop or switch to this group for this particular terminal by newgrp users). – madneon Mar 19 '15 at 13:40
  • Command adduser has --ingroup option to specify additional group membership while creating user, but adduser USER GROUP works fine as well. – madneon Mar 19 '15 at 13:48