Reputation: 1
Here is the problem: I use django pam to let django able to authenticate linux users but it can only be run as root. Is there any solutions to let normal user able to authenticate lunux users?
Upvotes: 0
Views: 608
Reputation: 1856
This is a bit round about, but I imagine it would work.
Assuming a debian distro, you could try adding the specific command that you want to a script, then chmod/chown it to restrict access to root only.
chown root:root /path/to/script.sh
chmod 755 /path/to/script.sh
Next, run sudo visudo
and add the following:
normalusername ALL = NOPASSWD: /home/usr/path/to/script.sh
Reboot, write some code in python to execute your script as a normal user, and I imagine you'd be good to go.
Your python code would look like this:
import os
os.system("sudo path/to/script.sh")
Upvotes: 1