LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-03-2014, 09:40 AM   #1
sammckee
Member
 
Registered: Aug 2003
Posts: 59

Rep: Reputation: 15
Sudoers entry but still asking password


Like the title says.

This is the last entry in my sudoers file (IP address redacted to protect the innocent):


backups ALL=(ALL) NOPASSWD:/usr/bin/rsync --rsync-path\='sudo /usr/bin/rsync' --verbose --archive --one-file-system -e 'ssh -o StrictHostKeyChecking\=no -o UserKnownHostsFile=/dev/null' --link-dest\=~/system_backup/data --hard-links --human-readable --inplace --progress --delete-excluded --numeric-ids --exclude-from\=excludes.txt javaguy@MY.PC.IP.ADDRESS\:/ /home/backups/system_backup/daily/current

I made sure to put it on the last line of sudoers because I've already gone through the pain of learning the hard way that if I put an entry in the middle it can get overridden by a later entry.

So then user backups runs my backup script, but it asks for a password when it gets to this line:

sudo /usr/bin/rsync --rsync-path='sudo /usr/bin/rsync' --verbose --archive --one-file-system -e 'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' --link-dest=~/system_backup/data --hard-links --human-readable --inplace --progress --delete-excluded --numeric-ids --exclude-from=excludes.txt javaguy@MY.PC.IP.ADDRESS:/ /home/backups/system_backup/daily/current

Any idea what I'm doing wrong?


Thanks,
Sam

Last edited by sammckee; 04-03-2014 at 09:44 AM.
 
Old 04-03-2014, 10:37 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
That's pretty crazy for a sudoers entry, why not put all that in a bash script and let them call that script?
 
Old 04-03-2014, 10:43 AM   #3
sammckee
Member
 
Registered: Aug 2003
Posts: 59

Original Poster
Rep: Reputation: 15
It's big, but it is a one-line command.

Since it's running as root I want to lock down exactly the rsync command the backups user is allowed to use, otherwise I'd be giving carte blanche to overwrite any file in the system using rsync.
 
Old 04-03-2014, 10:57 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
if they can't cahnge the script file that contains all of that, then it's no less secure, and vastly easier to troubleshoot the sudo part of the equation.
 
Old 04-26-2014, 10:35 AM   #5
fmagee
LQ Newbie
 
Registered: Jun 2013
Location: Albuquerque, NM
Distribution: RHEL 5.9 Server and Workstation, RHEL 6.4,Server and Workstation, OracleVM, HP/UX, Solaris
Posts: 9

Rep: Reputation: Disabled
sudoers error

When I enter a similar command I still get asked for the password. When I put the command in a script and put the script name in sudoers I still get asked for the password and it won't let me execute the command in the script. Example:

username hostname (root) NOPASSWD: /bin/chown -R /full/path/name/*

When I enter ":x" visudo gives me a syntax error. When I created a script "chown_tree" and put this in using visudo, I got no errors but when the user executes: sudo chown_tree it prompts for the password then reports insufficient permission to execute the command. How do I trouble shoot this problem?
 
Old 04-30-2014, 09:04 AM   #6
aedurkee
LQ Newbie
 
Registered: Sep 2012
Location: Tonawnada, NY
Distribution: CentOS Redhat ubuntu mint
Posts: 15

Rep: Reputation: Disabled
sudo

What is the sudo in your command line to be run? That might be prompting for for the password within the command line itself. Also does backups need to run sudo as all users, personal preference I would change ALL=(ALL) to ALL=(root) or ALL=(joeuser).
 
Old 05-01-2014, 05:23 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,997

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
Wonder if automake would create a more manageable way to run this?
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sudoers file and no password question uncle-c Linux - Newbie 4 04-29-2009 04:35 AM
Entry into group files (sudoers) Lazairus Linux - General 3 08-28-2008 08:05 AM
Sudoers file no password kamahl Linux - General 5 03-03-2008 08:40 AM
Sudo password for users, a.k.a. sudoers Micro420 SUSE / openSUSE 2 04-21-2006 09:23 PM
How to done entry in sudoers file??? rktech83 Linux - Security 1 03-29-2006 08:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:32 AM.

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