LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 06-11-2017, 01:39 AM   #16
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,289
Blog Entries: 3

Rep: Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718

I've moved around some of your reply to make it easier to answer.

Quote:
Originally Posted by xpdin View Post
Thank you very much to all for your replies.
Can someone say please, are there any disadvantages or advantages between the next method and the methods from the above posts?

Code:
sudo su
If you want a login shell for root, try sudo -i instead.

Quote:
Originally Posted by xpdin View Post
Create
Code:
/usr/local/bin/scriptname
and write the beyond lines in it:


Code:
#!/bin/bash
    
command in here without sudo
    
# the end of the scriptname
Code:
chown root:root /etc/sudoers.d/scriptname
chown root:root /usr/local/bin/scriptname
chmod 0700 /usr/local/bin/scriptname
chmod 0440 /etc/sudoers.d/scriptname
Yes, that looks good, depending on the details of the command. You have the script out of the way where only root can change it.

Instead of changing both configuration files, I'd put the following in /etc/sudoers.d/scriptname and leave /etc/sudoers alone.

Code:
username ALL=(ALL:ALL) NOPASSWD: /usr/local/bin/scriptname
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Sudo question specific commands on specific directories slufoot80 Linux - Security 6 12-30-2014 08:57 AM
[SOLVED] User not in sudoers: How to add user? Permtion Denied for sudoers file esgol Linux - Newbie 3 07-13-2012 07:44 AM
sudoers problem with using NOPASSWD in conjuction with runas everett-tek Linux - Newbie 3 07-29-2009 07:36 PM
[SOLVED] sudoers specific permission RaptorX Slackware 14 07-21-2009 01:56 AM
Why does "joe ALL=NOPASSWD: ALL" in sudoers not work? lumix Linux - Newbie 3 06-19-2008 12:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 12:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration