Re: sudoers tty defaults (Re: Changing Users in a script)

2011-08-30 Thread Bob Proulx
Tom H wrote: > I've just re-read the sudoers man page (after a VERY long time), > thinking that it would help me "refudiate" the fact that the > "Defaults" line had some in-built, unlisted defaults, when in fact, > I've been misusing "sudo -L" for more years than I care to remember... And I see th

Re: sudoers tty defaults (Re: Changing Users in a script)

2011-08-20 Thread Tom H
On Tue, Aug 16, 2011 at 6:37 AM, Walter Hurry wrote: > On Mon, 15 Aug 2011 17:33:58 -0400, Tom H wrote: > >> "sudo -L" lists the full list of "Defaults". I'd be very surprised if >> even one of these isn't set. > > Then prepare for a surprise. Vanilla /etc/sudoers in Squeeze: > > # /etc/sudoers >

Re: sudoers tty defaults (Re: Changing Users in a script)

2011-08-16 Thread Walter Hurry
On Mon, 15 Aug 2011 17:33:58 -0400, Tom H wrote: > "sudo -L" lists the full list of "Defaults". I'd be very surprised if > even one of these isn't set. Then prepare for a surprise. Vanilla /etc/sudoers in Squeeze: # /etc/sudoers # # This file MUST be edited with the 'visudo' command as root. # #

Re: Changing Users in a script

2011-08-16 Thread Bob Proulx
Hal Vaughan wrote: > Bob Proulx wrote: > > There are distinct advantages to a backup push system. Not proposing > > that you change away from it. But I tend to pull backups from /home > > to the backup server. This means that whatever is in /home comes over > > whether it is associated with a us

Re: Changing Users in a script

2011-08-15 Thread Hal Vaughan
On Aug 15, 2011, at 2:15 PM, Bob Proulx wrote: > Bob Proulx wrote: >> Hal Vaughan wrote: >>> The problem is sudo can't be run without a tty, so I can run it >>> myself, but it won't run from a script. >> >> Using 'su' would solve that problem. > > BTW... I assume that is because you have tty-t

Re: Changing Users in a script

2011-08-15 Thread Hal Vaughan
On Aug 15, 2011, at 2:05 PM, Bob Proulx wrote: > Hal Vaughan wrote: >> I have a system with several different users and would like to use >> cron to run this script as root: >> >> #!/bin/bash >> >> for user in `ls /home/`; do >> #echo "Path: $user" >> if [ "${user:0:1}" != "0" ]; then

Re: sudoers tty defaults (Re: Changing Users in a script)

2011-08-15 Thread Tom H
On Mon, Aug 15, 2011 at 3:51 PM, Walter Hurry wrote: > On Mon, 15 Aug 2011 13:12:04 -0600, Bob Proulx wrote: >> Tom H wrote: >>> Both are set by default. >> >> Just tty_tickets is set by default.  requiretty is off by default. >> >>   $ man 5 sudoers >> >>        tty_tickets     If set, users must

Re: sudoers tty defaults (Re: Changing Users in a script)

2011-08-15 Thread Bob Proulx
Walter Hurry wrote: > Bob Proulx wrote: > > Best would be to run 'sudo -l' and see what flags are actually set at > > the time. And remember that /etc/sudoers.d/* is a directory of > > additional snippets that are also included into the configuration. > > For what it is worth, I'm not sure that t

Re: sudoers tty defaults (Re: Changing Users in a script)

2011-08-15 Thread Walter Hurry
On Mon, 15 Aug 2011 13:12:04 -0600, Bob Proulx wrote: > Tom H wrote: >> Both are set by default. > > Just tty_tickets is set by default. requiretty is off by default. > > $ man 5 sudoers > >tty_tickets If set, users must authenticate on a per-tty >basis. >

sudoers tty defaults (Re: Changing Users in a script)

2011-08-15 Thread Bob Proulx
Tom H wrote: > Both are set by default. Just tty_tickets is set by default. requiretty is off by default. $ man 5 sudoers tty_tickets If set, users must authenticate on a per-tty basis. With this flag enabled, sudo will use a file named for

Re: Changing Users in a script

2011-08-15 Thread Tom H
On Mon, Aug 15, 2011 at 2:39 PM, Bob Proulx wrote: > Tom H wrote: >> Bob Proulx wrote: >>> >>> BTW...  I assume that is because you have tty-tickets turned on for >>> sudo?  In which case you could avoid it with sudo too by turning off >>> tty-tickets for this use case. >> >> I think that you're c

Re: Changing Users in a script

2011-08-15 Thread Bob Proulx
Tom H wrote: > Bob Proulx wrote: > > BTW... I assume that is because you have tty-tickets turned on for > > sudo? In which case you could avoid it with sudo too by turning off > > tty-tickets for this use case. > > I think that you're confusing "tty-tickets" with "requiretty". Ah... Likely. I

Re: Changing Users in a script

2011-08-15 Thread Tom H
On Mon, Aug 15, 2011 at 2:15 PM, Bob Proulx wrote: > Bob Proulx wrote: >> Hal Vaughan wrote: >> > The problem is sudo can't be run without a tty, so I can run it >> > myself, but it won't run from a script. >> >> Using 'su' would solve that problem. > > BTW...  I assume that is because you have tt

Re: Changing Users in a script

2011-08-15 Thread Bob Proulx
Bob Proulx wrote: > Hal Vaughan wrote: > > The problem is sudo can't be run without a tty, so I can run it > > myself, but it won't run from a script. > > Using 'su' would solve that problem. BTW... I assume that is because you have tty-tickets turned on for sudo? In which case you could avoid

Re: Changing Users in a script

2011-08-15 Thread Bob Proulx
Hal Vaughan wrote: > I have a system with several different users and would like to use > cron to run this script as root: > > #!/bin/bash > > for user in `ls /home/`; do > # echo "Path: $user" > if [ "${user:0:1}" != "0" ]; then > path="/home/$user/Backup" >