![]() Hibernate: (if enabled on your system) /usr/bin/dbus-send -system -print-reply -dest="" /org/freedesktop/UPower. Suspend: /usr/bin/dbus-send -system -print-reply -dest="" /org/freedesktop/UPower Restart: /usr/bin/dbus-send -system -print-reply -dest="" /org/freedesktop/ConsoleKit/Manager .RestartĬonsolekit should of course be installed your system. Shutdown: /usr/bin/dbus-send -system -print-reply -dest="" /org/freedesktop/ConsoleKit/Manager .Stop testuser ALL(ALL) NOPASSWD: /home/testuser/script.sh Ive also tried. From then on, it should work like a charm. Join Patreon Run sudo without password on CentOS Linux Backup /etc/sudoers file, run: sudo cp /etc/sudoers /root/sudoers. ![]() how to configure the system so that an unprivileged user can authenticate as another unprivileged user without being prompted for a password.That step requires root access, of course (and the OP does have it). This will create a newuser without root privileges to run commands in the container. ![]() On Ubuntu 16, there is a simpler way: just add the user to the sudo group, like this: sudo usermod -aG sudo username. SridharSarnobat The sudo visudo part is just a clarification on how to (safely) edit /etc/sudoers, i.e. This can be changed by creating a new user in a Dockerfile by: RUN useradd -ms /bin/bash newuser where -m -> Create the users home directory -s /bin/bash -> Set as the users default shell USER newuser. So Ive used visudo tried added the following line as both the 1st and last line in the file. As mentioned by Basilevs you need to add your user to the sudoers file in order to avoid that sudo commands in the script get stuck awaiting the password. Since hibernate is normally disabled by default in Ubuntu systems, you can enable this by checking this answer. Im trying to allow a specific user to run a specific command with sudo but not be prompted for a password in CentOS 7. (This is due to Ubuntu's shift in using systemd instead of Upstart) systemctl poweroff ![]() A safe way to do this without using sudo and without tinkering with the system, is by executing these one-liner commands: For Ubuntu 15.04 and later: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |