Live data from Hacker News

Chmod -x chmod

slideshare.net

31–34 of 34 posts

Re: Chmod -x chmod

#32
post #25

Earlier quoted context omitted.

Couldn't you just set an appropriate umask and then make a copy of chmod?

I don't think umask setting affects the executable bits of files, just directories. You can try by entering something like umask 0; touch foo; ls -l foo

It does affect files, but umask only subtracts permission bits. So if the program creating the file doesn't try to set it executable, then umask will never change that.

Re: Chmod -x chmod

#33
post #30

I'm stupid, I guess. I saw the last slide ("there is no problem as the system is still running" (and chmod can therefore still be executed)) and thought that was the solution. Once again I've learned that for every problem there is a solution that is clear, simple and wrong (and that I myself am quite likely to hit upon this solution). If you try it, you'll find that it doesn't, in fact, work. Apparently the shell pe…

I think the last slide just points out that there is no problem. The presenter never said you had to fix the chmod situation, just that the machine can't be rebooted. Maybe I misinterpreted...

Re: Chmod -x chmod

#34
post #28
post #19

Earlier quoted context omitted.

What about: find / -type f -perm +x | xargs chmod -x EDIT: chmod has to be the last program to be chmodded, in the above list.. :-)

Your use of xargs can lead to nasty surprises because of the separator problem http://en.wikipedia.org/wiki/Xargs#The_separator_problem GNU Parallel http://www.gnu.org/software/parallel/ does not have that problem. Watch the intro video for GNU Parallel: http://www.youtube.com/watch?v=OpaiGYxkSuQ

GNU Parallel isn't needed to avoid this, using find's -print0 and xargs's -0 would suffice. The advert is unwarranted.
Post reply on HN