Upon installation, I have created an extra partition and mounted it as /data. The partition is visible, but I get a Permission denied error when trying to create a file or directory in it. Doing it with sudo does work.

I am using ext4 filesystem. Ubuntu 14.04 x86_64.

I have tried deleting the partition, then creating it again and setting up fstab to use a new partition. That changed nothing.

How do I make the extra partition behave normally, e.g. be writable by users?


1 Answer 1


For new ext4 etc filesystem, you need to change the permissions so your user can access it and read/write to it - using for example:

sudo chown -R $USER:$USER /data

Where /data is the path to where the drive is mounted - if you do this in the wrong place it will likely break things.
$USER is replaced with the user's username by the shell.

For more info read the chown manual page [ 1] [2]:

man chown

And to view permissions on stuff you can use ls -ld /data for a directory, and ls -l /data for the files in it.

For some other filesystems - e.g. NTFS, you can specify the permissions via the mount options - see here.

  • Does that mean that only one user (the owner) will be able to write to it? Nov 28, 2015 at 21:55
  • 1
    Yes, depending on the read/write permissions for 'other' users (see chmod as well). You can make a group of users if you want more than one user to access the partition, and then replace the second $USER with that group name.
    – Wilf
    Nov 28, 2015 at 21:56
  • Exactly what should I enter instead of $USER:$USER? Nov 28, 2015 at 21:59
  • 1
    The shell should replace $USER - e.g. with mine it will do wilf. The first one specifies the user that will be owner, and the second the group. If not sure read the manual :)
    – Wilf
    Nov 28, 2015 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.