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.

Like the title says, is there a way to mount a partition (on boot or on login) for only one user, so that other users can't access the files but only me?

I searched for some fstab parameters but i found nothing I that would help.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Depending on what file system you are using for the mounted partition you can use the mount options gid=XX,uid=XXXX (group-id and user-id) - see man mount for more information on what file systems support them. Users are listed in /etc/passwd while groups are listed in /etc/group. For your user, you can use the id command. You can then set the umask-like options to set file permissions.

Here is an example of using them in /etc/fstab:

UUID=<xxxxx> /media/win ntfs rw,auto,nls=utf8,umask=077,gid=46,uid=1000    0   0

And here the same as a mount command:

sudo mount -U <xxxx> -t ntfs -o rw,auto,nls=utf8,umask=077,gid=46,uuid=100 /media/win

File systems that don't have gid and uid as an option, usually can have their rights set in the normal way after you mounted the partitionm i.e. recursively for all files with chmod go-rwx -R /media/mountpoint (or what ever other mountpoint suits your fancy).

share|improve this answer
    
Works but has a little constraint: If the other user has root rights (is in sudoers file), he can remount the partition manually to access it himself. –  André Stannek Sep 8 '12 at 8:49
    
Of course. Thank you so much for that comment; also you can only do this, if the disk is not broken... ;D –  con-f-use Sep 8 '12 at 8:58
    
I was trying to provide helpful information for @a2r considering he may be a beginner to linux who doesn't think of this. There is no need to be sarcastic about it. –  André Stannek Sep 8 '12 at 9:11
    
Chill out guys ;) I'm not a beginner, but also I'm not that skilled. I knew how to add partitions to the fstab (and that sudoers can do everything^^) The only thing i didn't know was the user and group management. I assume that "plugdev:x:46:arthur" means, that i am the only one in that group? And that this group is for plugin in devices? –  a2r Sep 8 '12 at 9:23
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.