5

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?

Wilf
  • 30,732

1 Answers1

7

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.

Wilf
  • 30,732