Saturday, April 20, 2024
 Popular · Latest · Hot · Upcoming
10
rated 0 times [  10] [ 0]  / answers: 1 / hits: 19149  / 3 Years ago, tue, july 20, 2021, 5:38:24

I know I can give permission to use "mount/unmount" through sudo some users without password.



But how can I give permission to use "mount/unmount" only for /dev/sda2 and not for /dev/sda10?



For example, some user can execute: sudo mount -t ntfs /dev/sda2 ~/mnt/ntfs

But the same user must not have permission to execute: sudo mount /dev/sda10 ~/mnt/s10


More From » mount

 Answers
5

you could create a simple file:



 sudo visudo -f /etc/sudoers.d/myOverrides 


with this directive:



 User ALL = NOPASSWD:/sbin/mount -t ntfs /dev/sda2 /home/User/mnt/ntfs


This allow User to runs mount command with those parameter without entering a password.



Here is sudo manual for more details.


[#22912] Wednesday, July 21, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
uxuriousrnal

Total Points: 279
Total Questions: 106
Total Answers: 96

Location: Fiji
Member since Wed, Mar 29, 2023
1 Year ago
uxuriousrnal questions
Wed, Mar 9, 22, 09:04, 2 Years ago
Mon, Jul 18, 22, 01:48, 2 Years ago
Wed, Apr 13, 22, 01:15, 2 Years ago
Thu, Aug 26, 21, 22:01, 3 Years ago
;