February 14, 20242 yr 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
February 18, 20242 yr 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
February 19, 20242 yr 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
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.