[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: chmod a-x chmod Fix?



On Fri, 2006-01-06 at 08:13 -0500, Chasecreek Systemhouse wrote:

> 
> Is there a way to execute chmod when it is set 0644?  Is there a way
> to change the file permissions when chmod is disabled?
> 

Here is a way - there are bound to be a number of others.

Use "cp -p" to copy an arbitrary file that already has the desired perms
(ie. 755) to a scratch file.

Use "cat" to overwrite the scratch file with the contents of the chmod
executable.

Replace /bin/chmod with the scratch file (using cp -p again).


Eg.

cp -p /usr/bin/autoconf /tmp/scratch
cat /bin/chmod > /tmp/scratch
cp -p /tmp/scratch /bin/chmod

You could also write a quick bit of C code to call the chmod system
call. See "man 2 chmod".

Cheers, Ben



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]