jumbo125 Posted February 14 Posted February 14 Hy i use octoprint on my orange pi. Now i need to resart and shutdown the system by octoprint. So i try shutdown -h 0 or systemctl poweroff nothing will work, cause i need to authenti. the user by password. so i tried to add the user to the sudoers... not work this is my line. i added the code at the end of the file myuser ALL=(ALL) NOPASSWD: /sbin/shutdown 0 Quote
c0rnelius Posted February 18 Posted February 18 Not sure about doing it for just one command, but you can make it so you don't need to authenticate when using sudo. sudo mkdir -p /etc/sudoers.d/ sudo tee /etc/sudoers.d/010_$USER-nopasswd <<EOF $USER ALL=(ALL) NOPASSWD: ALL EOF 0 Quote
Tony3 Posted February 19 Posted February 19 I did that in the past using sudoer functionalities. 0 Quote
c0rnelius Posted February 19 Posted February 19 This works for me. Edit it to fit the commands you want to be able to run. sudo tee /etc/sudoers.d/010_$USER-nopasswd <<EOF ${USER} ${HOSTNAME} = (root) NOPASSWD: /sbin/shutdown ${USER} ${HOSTNAME} = (root) NOPASSWD: /sbin/poweroff ${USER} ${HOSTNAME} = (root) NOPASSWD: /sbin/reboot EOF 0 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.