Sunday, 5 January 2020

linux - Allowing another user to execute program?


I want to allow a particular user to execute a compiled program in my directory. I got his username from cat /etc/passwd. The executable does not write any file but reads a few and gives output on the command line. How can I achieve this?



Answer



If your files are not a secret, you may simply make that folder readable to everyone, or to some group where you will put yourself and the other user.


If you have a scenario with users that should not be allowed access to reading those data, you will have to use a sudo-based strategy, so that the privileged user can run your program by means of for example:


sudo ~user19448/myprogram/runme

First you have to configure your sudo (by means of visudo) with something like:


particular-user ALL=(ALL) NOPASSWD: /home/user19448/myprogram/runme

NOPASSWD avoids you the need to enter your own password, which you probably want.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...