[Tex/LaTex] What does “restricted \write18 enabled” mean and why does TexLive keep reporting it

shell-escapetexlive

I've installed a backported version of TL2012 on Ubuntu 12.04, and every time I start pdftex, xetex, luatex, pdflatex, xelatex, or lualatex, I get the statement restricted \write18 enabled. entering extended mode. I don't recall seeing this in Miktex so I wonder whether I did something wrong during the installation. Interestingly, I don't get the message when I run tex.

First of all, what does it mean? Second, is it a normal message for Tex Live (2012)? Finally, if it is an error, how can I fix it?

Best Answer

For years \write18 has been used as a back door to the operating system. Syntactically TeX treats it as writing to a file, but register 18 is treated as a pre-opened file that in fact executes commands.

"unrestricted" write18 means that you can execute any command so if you allow this and run a TeX file that someone sent you it may execute arbitrary code, email your password file to a spam bot or whatever.

That is obviously a security risk but there are some commands that are naturally part of the Tex distribution that you might want to always allow (such as image and font conversion) so web2c allows you (or the texlive maintainers by default) to set up a set of "allowed, safe" commands and these are allowed to run in restricted mode.

The third alternative is never to execute commands at all from \write18.

Related Question