![]() My question: What is the difference between 'chmod +s halt' and NOPASSWD for shutdown as you suggested? I am not familiar with NOPASSWD. My fix was to chmod +s halt and reboot, allowing the halt and rebnoot command to be executed from the menu. When I set the menu command to "sudo shutdown" it worked as long as I had used sudo in a terminal in the last 5 minutes (or whatever the time limit is) but would just freeze if I hadn't used sudo recently. Then, add the following line at the end of the file: jdoe ALL (ALL) NOPASSWD:ALL. This opens the sudoers file in the text editor. For example, if you want to add the user jdoe to the sudoers file without a password, you can run the following command: sudo visudo. In the next step, scroll down and locate a line. Interrupt the booting process by pressing ‘e’ on the keyboard to make changes to the boot entry. The first entry will be selected by default as shown below. Firstly, reboot or power on your Arch system. Just so we are on the same page: I wanted an entry on my openbox menu for reboot and shutdown so I could right-click the desktop and select reboot or shutdown. This line allows the user to run any command with sudo without entering a password. Keep Reading: How to Reset Forgotten Root Password in CentOS 8. Imo, it's better to have one more step between you and the execution of a sudo command. If a user runs a nasty script by accident, that could be a real problem. Why wouldn't you use the NOPASSWD for shutdown ? Aside from the sudo password being the user's password and not root's as pointed out already, NOT requesting a password means that scripts run by the user can invoke sudo undetected. Note that this will produce an error if your sudo access token is active, if you don't need to enter your password because you've already done so recently. So, to run ls with sudo privileges, you would do. At least I couldn't get it to.Įdit: And what is the SECURITY risk for allowing someone to shutdown the computer?įunny, shutdown via sudo works alright in the openbox menu for me.ĮDIT: Oh, I think I see what you meant. The password must be followed by a newline character. I found sudo still popped up to ask me password even after I had added my user with ‘NOPASSWD: ALL’ in visudo. you do not have /etc/sudoers ), run as root: apt install sudo. If the package sudo is not installed (e.g. In Debian, depending on the installation options, you often end up without sudo installed by default. Or if you want shutdown in the menu sudo doesn't work right. So to add passwordless sudo enabled users to a Debian based system, the steps are: Install sudo. ![]() What's wrong with using sudo for shutting down ? The millisecond in which you gain root privileges before the system goes down is a security risk !?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |