restart nginx service without sudo [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I need to restart the Nginx service without a password attempt.
I find out there is a way with sudoers. so I add blow command in sudoers but it's not working. I have ubuntu 19.4.
anonymous ALL=(ALL:ALL) NOPASSWD: /usr/sbin/systemctl restart nginx
so sudo systemctl restart nginx must work without any password attempt.

Look for sudo events in /var/log/auth.log.
Confirm that systemctl is in fact at /usr/sbin/systemctl (it may be in /bin/systemctl).
Ensure that you are running as user anonymous on this system for the above sudoers to work.

Related

Does systemctl daemon-reload need to be executed using root/sudo? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 12 months ago.
Improve this question
Does systemctl daemon-reload need to be executed using root/sudo? and does the same command apply to both Centos 7 and Ubuntu 18.04.3 LTS?
$ systemctl daemon-reload
==== AUTHENTICATING FOR org.freedesktop.systemd1.reload-daemon ====
Authentication is required to reload the systemd state.
Authenticating as: neo
Password:
Yeah, I'd say so.
Unless you are doing it in a container with root privileges, pretty sure you need to have root permissions for anything related to systemd services.

Why should I execute these commands? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I found these commands in a tutorial to setup selenium on linux. I'm not sure what they do, or why they are needed.
sudo chown root:root /usr/bin/chromedriver
sudo chmod +x /usr/bin/chromedriver
The post in question is here:
https://www.ultralinux.org/post/how-to-install-selenium-python-in-linux/
The first command make the superuser the owner of chromedriver. This is a good idea for programs that are installed in /usr/bin, to prevent ordinary users from modifying them (I assume the file is only writable by the owner, which is the usual default).
The second command adds execute permission for the user, group and others. This ensures that anyone can run the program.

change root#<name> in Ubuntu 18.04 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
On my machine i'm getting "root#umar" that I want to change to "root#junaid". I have tried running different commands. They do change my username but above mentioned name is not changing.
See in above image. User I'm logged in as is "Junaid". But before that there is "root#umar" that I want to be changed to "root#junaid". Solutions I have tried change my current username that I'm loggedIn as.
Any solution?
"umar" is the hostname. So you should change it to get prompt like "root#junaid"
To do this on the fly you should exec next command:
sudo hostname junaid
sudo vi /etc/hostname
(to update the hostname there)
and the same in hosts file
sudo vi /etc/hosts
If you run commands as root you do not need to have sudo

How to execute sudo as user with root password [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
How can I configure Linux to see the prompt for the root password if Sam try to execute the following command: $ sudo mkdir /opt/test?
If Sam is part of sudoers, the terminal ask for the user password not for the root password.
In /etc/sudoers, add this line:
Defaults rootpw
Make sure you use visudo for editing this file. For more information, you can check the link

How to use Ansible service module in playbooks with limited sudo? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I'm writing a playbook to deploy an application. I'm SSH'ing as a regular user, not root. After my application finishes deploying I want to restart its service. Obviously, to restart a service I need some sort of sudo privileges.
In my /etc/sudoers file I have:
redadmin ALL=(root) NOPASSWD: /usr/sbin/service apache2 *
However, when I run my Ansible playbook it hangs when it gets to:
- name: Restarting apache
service: name=apache2 state=restarted
sudo: yes
How can I modify my playbook to use Ansible's service module without giving redadmin user full root privileges?

Resources