Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I need to mount an ntfs disk with the certain permission and for an user alex be able to have the same as root would have.

Here is my file /etc/fstab

/dev/sda2 /media/win_disk ntfs-3g rwx,locale=en_US.utf8 0 0

When I try to mount it, it says

An error occurred while accessing '421.8 GiB Hard Disk (ntfs)', the system responded: The requested operation has failed.: Error mounting: mount exited with exit code 1: helper failed with:
mount: only root can mount /dev/sda2 on /media/win_disk

How do I get rid of it?

share|improve this question
    
Try adding the user option, so: /dev/sda2 /media/win_disk ntfs-3g rwx,user,locale=en_US.utf8 0 0. But also, I've never seen this rwx option. –  Alaa Ali Jun 14 '13 at 6:42
    
@Alaa, what if I want it to have rwx permissions, how do I do that then if not use rwx? –  Alan Dert Jun 14 '13 at 7:22
    
rwx permissions for who? The owner (user), group, or other? To control permissions, you'll need to use the umask option, and to control ownership, you need to use the uid and gid options. Who do you want to be the owner of all files under the partition? You? The usual approach is that you make yourself the owner, and give yourself rwx permissions. –  Alaa Ali Jun 14 '13 at 7:38
    
@Alaa, rwx for everybody. –  Alan Dert Jun 14 '13 at 7:53
    
Look at my answer and the comment there. –  Alaa Ali Jun 14 '13 at 7:58
add comment

1 Answer 1

up vote 1 down vote accepted

Follow the below.

  1. We'll unmount the partition, just in case.

    sudo umount /media/win_disk
    
  2. We'll delete the mount point and recreate it to make sure that it has the correct permissions.

    sudo rm -r /media/win_disk
    sudo mkdir /media/win_disk
    
  3. Open up your /etc/fstab, delete the line that you added, and add this line instead:

    /dev/sda2    /media/win_disk    ntfs-3g     rw,auto,user,exec,nls=utf8,umask=003,gid=46,uid=1000    0    0
    

    This will:

    • auto: automount the partition.
    • rw: mount it as read-write.
    • user: allow users to mount/unmount it.
    • uid=1000: make the user with user ID 1000 as the owner of everything in the partition.
    • gid=46: make the group plugdev as the group owner (don't mind this).
    • umask=003: make everything under the partition have the permissions -rwxrwxr--.

    All of this basically means that you will be the owner, and you'll have rwx permissions for everything. It will also automount the partition when you reboot the machine. If you don't want it to automount, just change auto to noauto.

    Note: see that uid=1000? You need to change that to be your user ID. It is most probably 1000, but just to be sure, do the command id and look at the number after uid=###(your_username). If that number is not 1000, then change uid= to be that number.

  4. Save the file and close it, then do

    sudo mount -a
    

    You should not get an error, and you should find your partition mounted. If you get an error, do not restart your machine and tell us what the error is.

For more information about fstab and its options, visit the Fstab Ubuntu help page.

share|improve this answer
    
If you want to give everybody rwx, so all the files and folders will have permissions like this: -rwxrwxrwx, then change the umask option to be umask=000. –  Alaa Ali Jun 14 '13 at 7:58
    
that's great. will it be mounted automatically every time as the system starts? –  Alan Dert Jun 15 '13 at 0:51
    
Yes, but as I mentioned underneath the bullet points, you can change auto to noauto. That way, it won't be mounted automatically at system startup. –  Alaa Ali Jun 15 '13 at 5:01
    
thanks. but nonetheless, I saw many threads where people asked how to make a disk mount automatically and they suggested them other, more complicated solutions. it was weird, did no one know about auto and noauto? –  Alan Dert Jun 15 '13 at 6:17
    
That's weird, because it's common to use auto. I think those other complicated solutions eventually end up modifying the fstab file to use auto through some scripts. Just a point to note: if you're using noauto, the last command in my answer sudo mount -a will not mount the partition. To mount it, you'll have to do sudo mount /dev/sda2 (or sudo mount /media/win_disk). It should then read all the options from the fstab file to give the proper permissions and ownership. –  Alaa Ali Jun 15 '13 at 7:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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