I have a number of external media with VeraCrypt encrypted file containers and I would like the users to mount and use them without giving root privileges to the users.
However at the moment VeraCrypt's always asking for user/admin password apparently sudo-ing mount operation:
How can a user, who's not in the sudoers file mount an .hc file?
Warning: Only use @Pawel Debski solution if agree the following:
So using that solution you might consider to use a special user profile for veracrypt. As a result, sodo is easier to use.
Steps to test the security problem:
The binary will run with root privilege.
Hint: I added this solution as the warning at Pawel Debski is inconspicuously. The risk is much greater than the benefit as long as the system has an internet connection.
You can allow other users to run sudo to access only certain programs. For instance, I allow user www-data to run /sbin/ipset to ban users who try to hack in to my web server. I admit this was on a raspberry pi running a modified version of debian.
I created a file in folder /etc/sudoers.d The contents of the file were
I did it. The solution's adapted from here: https://wiki.archlinux.org/index.php/TrueCrypt#Mount_volumes_as_a_normal_user and from my other question regarding modern sudoers config: adding local content in /etc/sudoers.d/ instead of directly modifying sodoers file via visudo
veracryptusers
and give it the necessary permissions to use VeraCrypt without root password. Any user that belongs to that group will be able to use VeraCrypt.Note: this dramatically increases attack surface for user rights elevation, so be sure to add only trusted users to this group.
Also please make sure that
veracrypt
and/usr/bin
have the proper permissions and are NOT writable by groups nor others:Otherwise a malicious user may replace the executable and gain total root right at his wish.
Now reboot (or relogin) to have groups membership revaluated and voilà - you can mount and unmount your favourite volumes.
Please also be sure to review privilege escalation loophole described at the link below and before adding users to the group consider whether you can trust them
What about this? Am I wrong or right or what?
Just simply create a user for veracrypt and add it in
/etc/sudoers.d