Mailing List
Home
Forum Home
Linux - General Red Hat Linux discussion list
Enterprise Linux 3 - Discussion of Red Hat Enterprise Linux 3 (Taroon)
Installation - Getting started with Red Hat Linux
Red Hat Linux 9 - Discussion of Red Hat Linux 9 (Shrike)
Red Hat Linux 7.3 - Discussion of Red Hat Linux 7.3 (Valhalla)
Red Hat Linux 7.2 - Discussion of Red Hat Linux 7.2 (Enigma)
Apache Web Server
Oracle database, Microsoft SQL server ...
Subjects
application/x mplayer2 plugin
RPM error: db4 error(16) from dbenv >remove: Device or resource
   busy
Command stream end of file while reading
X Windows problem (xauth)
Upgrading openoffice 1 1 rpm
FTP: connection refused
FTP: connection refused
mount: /dev/cdrom: is not a valid block device
Dell Precision 650, RedHat 9, no sound
how to trace the cause resulting in the crash of bind server
Virus on the list
UNINSTALL RPM MYSQL
usb pen drives: mounting as a user
broadcom network interface
make mrproper
sendmail configuration on redhat
Couldn 't open PID file /var/run/named/named pid Permission denied
Promise 378 controller
kernel 2 6 and /dev/sound/mixer not found
Problem using up2date
mrtg step by step howto/configuration for a newbie?
Compiling and Installing Kernel 2 6
Can 't locate module ppp0, can 't locate module ppp compress 21
HOW I CAN MAKE BOOTABLE FLOPPY DISKET
Lotus Notes under Wine
/etc/security/limits conf question
Intel E/1000 driver
Command stream end of file while reading
rpm database corrupt
qla2300 modules
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
SUDO QUESTION

SUDO QUESTION

2003-07-31       - By jim car

 Back
Reply:     1     2     3     4     5  

Gordon,

Thanks for the suggestion but I was able to figure out a different way to
get the same result.

Using sudo I copied the httpd config file to a backup copy and an httpd.tmp
file.  Then I used
changed the ownership of the httpd.tmp file to the user that is running the
script, redirected
the new config info to the httpd.tmp and the sudo copied the httpd.tmp file
to the real httpd.conf
file.

Thanks for the help.

On the desktop - MacOS X
In the server room - Linux
Windows? In the trash?




>From: "jim car" <macosxwhatelse@(protected)>
>Reply-To: psyche-list@(protected)
>To: psyche-list@(protected)
>Subject: Re: SUDO QUESTION
>Date: Wed, 30 Jul 2003 05:10:20 -0700
>
>Gordon -
>
>There is a problem with the command you suggested.  When you run
>
>sudo dd if=./httpd.tmp of=/etc/httpd/conf/httpd.conf
>
>the contents of httpd.tmp just overwrites /etc/httpd/conf/httpd.conf
>
>Looking at the dd man page I played with the seek and notrunc options.
>With seek it will keep the original file then add however much blank space
>until
>you reach the seek amount and then write httpd.tmp to httpd.conf.   Problem
>then becomes the second time you run the script it will write over what was
>written
>during the first run unless I were to delete all of the blank lines.
>
>Even though notrunc is listed in the man page and on the little help
>description of
>dd, when you try to issue the command there is an error stating that
>notrunc is not
>a recognized option of dd.
>
>Any ideas?  Thanks.
>
>
>On the desktop - MacOS X
>In the server room - Linux
>Windows? In the trash?
>
>
>>From: Gordon Messmer <yinyang@(protected)>
>>Reply-To: psyche-list@(protected)
>>To: psyche-list@(protected)
>>Subject: Re: SUDO QUESTION
>>Date: Tue, 29 Jul 2003 22:12:12 -0700
>>
>>jim car wrote:
>>>Why can't a user issue the following commands using sudo?  It always
>>>comes back as permission denied.  The sudoer's password is accepted.
>>>
>>>sudo cat ./httpd.tmp >> /etc/httpd/conf/httpd.conf
>>
>>In this example, two things are happening:
>>1) sudo authenticates the user and runs "cat ./httpd.tmp" as root
>>2) the user's shell attempts to open /etc/httpd/conf/httpd.conf and write
>>the output of "sudo" into that file.
>>
>>Redirection is not handled by "sudo", or any other command you run: it's a
>>function of the shell in which the redirection was requested. Naturally,
>>you can't sudo that.  You can however, accomplish what you want this way:
>>
>>cat ./httpd.tmp | sudo dd if=/dev/stdin of=/etc/httpd/conf/httpd.conf
>>   ( useless use of cat, primarily intended to display the use of
>>     /dev/stdin )
>>
>>or more simply:
>>
>>sudo dd if=./httpd.tmp of=/etc/httpd/conf/httpd.conf
>>
>>dd, unlike the shell, will do redirection in a command that can be evoked
>>from sudo.
>>
>>
>>
>>--
>>Psyche-list mailing list
>>Psyche-list@(protected)
>>https://www.redhat.com/mailman/listinfo/psyche-list
>
>__ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ __
>MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
>http://join.msn.com/?page=features/virus
>
>
>--
>Psyche-list mailing list
>Psyche-list@(protected)
>https://www.redhat.com/mailman/listinfo/psyche-list

__ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ __
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
http://join.msn.com/?page=features/virus




Earn $52 per hosting referral at Lunarpages.