Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 1193  / 1 Year ago, thu, february 16, 2023, 10:02:38

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


More From » chown

 Answers
5

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.


[#33452] Saturday, February 18, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
hreadsoplet

Total Points: 220
Total Questions: 108
Total Answers: 105

Location: Serbia
Member since Fri, Jun 3, 2022
2 Years ago
;