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.

Embarrassed to ask this, but have never had to face this before, so... here goes.

Some things to know:

  • I have terabytes of storage on a PC that is connected to my television.
  • I have kids who think the word "DELETE" means "FUN!"

What I'd like to do is:

  • Be able to leave the PC logged in.
  • Lock down /mnt/media1 and /mnt/media2 from the PC's default user (chow)
  • Any changes to the above done via sudo

Ideally, I'd mount those as read-only and then use the sudo command on all cp, mv, etc. changes I'd need...

chown, mount?

Help. :) Before my kids delete 400 gigabytes of the photos we've taken of them. :P

-Chow

share|improve this question
    
The recommended way for access control is setting up acl. See the following questions for solutions: askubuntu.com/questions/82628/…, askubuntu.com/questions/46716/…, askubuntu.com/questions/52584/shared-folders-for-all-users –  Takkat Dec 30 '12 at 6:50

3 Answers 3

up vote 1 down vote accepted

Since the drive is formatted as NTFS, something different than normal needs to be done. As NTFS does not support Unix-style file permissions, you will need to protect your drive by mounting it read-only. Assuming it is already mounted, you can do:

sudo umount /mnt/media1 /mnt/media2
sudo mount -o ro /dev/<device> /mnt/media1
sudo mount -o ro /dev/<device> /mnt/media2

These will remount your drives in read-only mode, so you can't even modify them with sudo. To be able to modify them, do:

sudo umount /mnt/media1 /mnt/media2
sudo mount -o rw /dev/<device> /mnt/media1
sudo mount -o rw /dev/<device> /mnt/media2

Make your modifications (without sudo), and then execute the top two commands to protect them again.

Hope this answers your question.

share|improve this answer
    
[chow] (/mnt) >> sudo mount -o remount,rw /mnt/media1 Remounting is not supported at present. You have to umount volume and then mount it once again. –  chow Dec 31 '12 at 22:34
    
Edited my answer. Hope this fixes it. –  Andrew Soutar Jan 1 '13 at 16:42
    
This'll do -- thanks. :) –  chow Jan 7 '13 at 5:49

I think

chmod -R o-w,a+r /mnt/media1 /mnt/media2

is sufficient.

and open standard accounts for kids.

change your password with passwd command.

That would be easier than typing sudo for any change to the disks.

share|improve this answer

The best way to do this is to simply change the ownership and permissions of all the files. Beware that this may take a while, depending on how much you have saved on your drives. You can leave it mounted read-write, but you would still need to use sudo for all operations to the files.

Assuming they are already mounted (at the locations stated above), you can just do:

chmod -R o-w,a+r /mnt/media1 /mnt/media2
chown -R root:root /mnt/media1 /mnt/media2

The first command makes all the files within /mnt/media1 and /mnt/media2 readable to everybody and writable only to the owner or group. The next command changes the owning user and group to root so that you need to use sudo to modify anything on the drive. You will only have to run these commands once; after that, they are permanently stored on the drive.

This will sufficiently protect your drive from user tampering while maintaining the readability of its stored contents.

share|improve this answer
    
Those commands aren't changing the mod/ownership of the files. I forgot to mention, the drive is ntfs... would that prevent me from achieving this? –  chow Dec 31 '12 at 18:49
    
@chow that is a problem, as Unix-style permissions are not supported in NTFS. I will add another answer to try to solve this problem. –  Andrew Soutar Dec 31 '12 at 19:09

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.