Does systemctl daemon-reload need to be executed using root/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 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.

Related

disable oracle-xe-21c service on Linux (Ubuntu) [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 months ago.
The community reviewed whether to reopen this question 9 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I need to be able to start the oracle-xe-21c at will, and do not want it to start automatically at system boot.
The command:
sudo systemctl disable oracle-xe-21c
returns the following:
oracle-xe-21c.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable oracle-xe-21c
update-rc.d: error: oracle-xe-21c Default-Start contains no runlevels, aborting.
How can I disable automatic startup?. I am on Lubuntu 20.04.
Suggesting to remove oracle-xe-21c.service file from the service folder will disable the service.
sudo mv /etc/systemd/system/oracle-xe-21c.service /home/oracle

restart nginx service without 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 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.

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 see if a service is running on Linux? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 3 years ago.
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.
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.
Improve this question
I'm using systemctl to setup and run my serviced on a Linux Redhat. How can I check if a service is in running state?
I can use
systemctl is-active <service name>
to check if the service is is active or not. But I would like to check if the service is in the substate running.
systemctl status name.service
check this out
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-managing_services_with_systemd-services
$ sudo service httpd status
OR you can check with list of services
$netstat -plnt

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