How to fix script to umount device without password?

0

I have added a file named: umountscript to /etc/sudoers.d/ with this directive:

xikri ALL=(root) NOPASSWD:/home/x/umountscript.sh

inside umountscript.sh I have this code:

umount /mnt/devicex

But when I run the script I get this message:

umount: /mnt/devicex: umount failed: Operation not permitted

Do I need to do something additional to make this work?

Carlos

Posted 2019-01-19T03:30:53.253

Reputation: 23

Answers

0

Yes, you need to invoke sudo otherwise sudoers is ignored, so

umount /mnt/devicex 

davidgo

Posted 2019-01-19T03:30:53.253

Reputation: 49 152