Re: sudo question

2024-11-22 Thread Greg Wooledge
On Fri, Nov 22, 2024 at 15:25:49 -0500, Roy J. Tellason, Sr. wrote: > Why would you want to append to a file that some other program is also > writing to? Sounds messy... Opening a file in append mode has the following behavior: O_APPEND The file is opened in append mode

Re: sudo question

2024-11-22 Thread Roy J. Tellason, Sr.
On Thursday 21 November 2024 02:16:48 pm Greg Wooledge wrote: > On Thu, Nov 21, 2024 at 19:55:04 +0100, to...@tuxteam.de wrote: > > On Thu, Nov 21, 2024 at 06:44:37PM +, Darac Marjal wrote: > > > > [...] > > > > > If it helps, "sponge" (in the moreutils package) seems to offer the right > > >

Re: sudo question

2024-11-21 Thread tomas
On Thu, Nov 21, 2024 at 02:16:48PM -0500, Greg Wooledge wrote: > On Thu, Nov 21, 2024 at 19:55:04 +0100, to...@tuxteam.de wrote: > > On Thu, Nov 21, 2024 at 06:44:37PM +, Darac Marjal wrote: > > > > [...] > > > > > If it helps, "sponge" (in the moreutils package) seems to offer the right > >

Re: sudo question

2024-11-21 Thread Greg Wooledge
On Thu, Nov 21, 2024 at 19:55:04 +0100, to...@tuxteam.de wrote: > On Thu, Nov 21, 2024 at 06:44:37PM +, Darac Marjal wrote: > > [...] > > > If it helps, "sponge" (in the moreutils package) seems to offer the right > > interface here: > > [...] > > Oh, wow -- thanks for that little gem! For

Re: sudo question

2024-11-21 Thread tomas
On Thu, Nov 21, 2024 at 06:44:37PM +, Darac Marjal wrote: [...] > If it helps, "sponge" (in the moreutils package) seems to offer the right > interface here: [...] Oh, wow -- thanks for that little gem! Cheers -- t signature.asc Description: PGP signature

Re: sudo question

2024-11-21 Thread Darac Marjal
On Thu, Nov 21, 2024 at 01:35:15PM +0100, to...@tuxteam.de wrote: On Thu, Nov 21, 2024 at 07:22:53AM -0500, g...@wooledge.org wrote: On Thu, Nov 21, 2024 at 09:48:06 +0100, to...@tuxteam.de wrote: [...] > My favourite is actually "sudo dd of=" it hasn't the side effect > of flooding your std

Re: sudo question

2024-11-21 Thread Hua Y
On 2024-11-21 20:15, Greg Wooledge wrote: On Thu, Nov 21, 2024 at 08:14:35 +0100, Erwan David wrote: On Thu, Nov 21, 2024 at 07:39:33AM CET, Bitfox said: > > BTW, what’s the difference between [[ ]] and [ ] here? I know only the > latter. IIRC, [[ ]] is a bash/zsh builtin, [ ] is /bin/[ other

Re: sudo question

2024-11-21 Thread Nicolas George
g...@wooledge.org (12024-11-21): > Checking my local Debian man pages now, however, I see that Debian's dd > (GNU coreutils) *does* offer an append option. > > dd oflag=append conv=notrunc of="$file" > > So I guess that's another viable choice, as long as your target system > has GNU coreutil

Re: sudo question

2024-11-21 Thread tomas
On Thu, Nov 21, 2024 at 07:22:53AM -0500, g...@wooledge.org wrote: > On Thu, Nov 21, 2024 at 09:48:06 +0100, to...@tuxteam.de wrote: [...] > > My favourite is actually "sudo dd of=" it hasn't the side effect > > of flooding your stdout (esp. with a larger, uglier thing). Thanks for all the detai

Re: sudo question

2024-11-21 Thread greg
On Thu, Nov 21, 2024 at 09:48:06 +0100, to...@tuxteam.de wrote: > On Thu, Nov 21, 2024 at 08:32:30AM +, Michael Kjörling wrote: > > On 20 Nov 2024 17:49 -0500, from g...@wooledge.org (Greg Wooledge): > > >> sudo echo "something" >>/etc/postfix/virtual_alias_maps > > > > > >> Can you help me wh

Re: sudo question

2024-11-21 Thread Greg Wooledge
On Thu, Nov 21, 2024 at 08:14:35 +0100, Erwan David wrote: > On Thu, Nov 21, 2024 at 07:39:33AM CET, Bitfox said: > > > > BTW, what’s the difference between [[ ]] and [ ] here? I know only the > > latter. > > IIRC, [[ ]] is a bash/zsh builtin, [ ] is /bin/[ other name of > /bin/test That's part

Re: sudo question

2024-11-21 Thread tomas
On Thu, Nov 21, 2024 at 08:32:30AM +, Michael Kjörling wrote: > On 20 Nov 2024 17:49 -0500, from g...@wooledge.org (Greg Wooledge): > >> sudo echo "something" >>/etc/postfix/virtual_alias_maps > > > >> Can you help me why the first sudo failed? > > > > The redirection >> is being done before

Re: sudo question

2024-11-21 Thread Michael Kjörling
On 20 Nov 2024 17:49 -0500, from g...@wooledge.org (Greg Wooledge): >> sudo echo "something" >>/etc/postfix/virtual_alias_maps > >> Can you help me why the first sudo failed? > > The redirection >> is being done before sudo is executed. Indeed. The usual pattern if you need to do this in a non-

Re: sudo question

2024-11-21 Thread Jeffrey Walton
On Wed, Nov 20, 2024 at 9:42 PM Bitfox wrote: > > In my bash shell script, when I say: > > sudo echo "something" >>/etc/postfix/virtual_alias_maps > > it could not run with the prompts: > > bin/mask.sh: line 18: /etc/postfix/virtual_alias_maps: Permission denied > > > but, if I just say: > > echo

Re: sudo question

2024-11-20 Thread Erwan David
On Thu, Nov 21, 2024 at 07:39:33AM CET, Bitfox said: > > BTW, what’s the difference between [[ ]] and [ ] here? I know only the > latter. IIRC, [[ ]] is a bash/zsh builtin, [ ] is /bin/[ other name of /bin/test -- Erwan David

Re: sudo question

2024-11-20 Thread Bitfox
On 2024-11-21 13:21, Jeffrey Walton wrote: On Wed, Nov 20, 2024 at 9:42 PM Bitfox wrote: In my bash shell script, when I say: sudo echo "something" >>/etc/postfix/virtual_alias_maps it could not run with the prompts: bin/mask.sh: line 18: /etc/postfix/virtual_alias_maps: Permission denied

Re: sudo question

2024-11-20 Thread eben
On 11/20/24 17:49, Greg Wooledge wrote: On Thu, Nov 21, 2024 at 06:17:31 +0800, Bitfox wrote: sudo echo "something" >>/etc/postfix/virtual_alias_maps https://mywiki.wooledge.org/BashPitfalls#pf53 Can you help me why the first sudo failed? The redirection >> is being done before sudo is exe

Re: sudo question

2024-11-20 Thread Keith Bainbridge
Sounds like making bin/mask.sh executable by root ONLY might help you forget to use sudo to run it Sudo chmod /bin/mask.sh x=rshould do it -- All the best Keith Bainbridge keithr...@gmail.com +61 (0)447 667 468 GMT+ 10:00 Sent from my Aphone. Please excuse my brevity. On 21 November 2

Re: sudo question

2024-11-20 Thread Greg Wooledge
On Thu, Nov 21, 2024 at 06:17:31 +0800, Bitfox wrote: > sudo echo "something" >>/etc/postfix/virtual_alias_maps https://mywiki.wooledge.org/BashPitfalls#pf53 > Can you help me why the first sudo failed? The redirection >> is being done before sudo is executed.

sudo question

2024-11-20 Thread Bitfox
Hello, In my bash shell script, when I say: sudo echo "something" >>/etc/postfix/virtual_alias_maps it could not run with the prompts: bin/mask.sh: line 18: /etc/postfix/virtual_alias_maps: Permission denied but, if I just say: echo "something" >>/etc/postfix/virtual_alias_maps and run tha

Re: sudo question

2004-01-10 Thread Andreas Janssen
Hello Russ Schneider (<[EMAIL PROTECTED]>) wrote: > It seems that even with a standard sudo entry such as: > user1localhost = (root) /usr/sbin/processd > > some processes will return "Only root should start processd". You didn't forget to call "sudo processd" instead of "processd", did you?

sudo question

2004-01-10 Thread Russ Schneider
It seems that even with a standard sudo entry such as: user1localhost = (root) /usr/sbin/processd some processes will return "Only root should start processd". Or, when giving a regular user permission to run something like lsof, lsof will still only return the open files for that user, and