सेवा पुनरारंभ के लिए कार्य नहीं कर रहा है


0

मैं उबंटू में एक सेवा को रूट किए बिना पुनः आरंभ करने में सक्षम होना चाहता हूं।

$ whoami

ubuntu

फिर मैंने किया:

सुडो विडो

और मैंने एक पंक्ति जोड़ी:

ubuntu ALL = NOPASSWD: /usr/sbin/service javaspringapi restart

और फ़ाइल को बचाया। परिणाम sudoers फ़ाइल:

sudo cat / etc / sudoers

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

ubuntu ALL = NOPASSWD: /usr/sbin/service javaspringapi restart

अब जब मैं कमांड चलाने की कोशिश करता हूं:

/ usr / sbin / सेवा javaspringapi पुनरारंभ करें

मुझे अभी भी मिलता है:

 ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units === 
 Authentication is required to restart 'javaspringapi.service'.
 Authenticating as: Ubuntu (ubuntu) 
 Password:

जवाबों:


1

Sudoers फ़ाइल को केवल तभी संदर्भित किया जाता है जब आप चलाते हैं sudo(इसलिए नाम)।

तो आपको सेवा को फिर से शुरू करने में सक्षम होना चाहिए

sudo /usr/sbin/service javaspringapi restart

पासवर्ड के लिए संकेत दिए बिना यह है कि आपने क्या कॉन्फ़िगर किया है।

हमारी साइट का प्रयोग करके, आप स्वीकार करते हैं कि आपने हमारी Cookie Policy और निजता नीति को पढ़ और समझा लिया है।
Licensed under cc by-sa 3.0 with attribution required.