Skip to content
Advertisement

Alternate program for ‘less’ linux command/Making ‘less’ Secure

I want to write an interactive program like ‘less’ command for Linux. Reason I can’t use less in my setup because you can execute shell commands within less prompt ‘!cmd’ which can be a major security risk for any production box.

My preferred language is C, however, if anyone can suggest any other similar program that will be great too, owing to the time I have in my hand.

I know one option will be to browse through the less source code, but it looks like that is not very straight forward either in short time.

Advertisement

Answer

Amazing, I got the answer in Man page of less itself. You can disable these stuff using one of the variables.

SECURITY When the environment variable LESSSECURE is set to 1, less runs in a “secure” mode. This means these fea‐ tures are disabled:

          !      the shell command

          |      the pipe command

          :e     the examine command.

          v      the editing command

          s  -o  log files

          -k     use of lesskey files

          -t     use of tags files

                 metacharacters in filenames, such as *

                 filename completion (TAB, ^L)

   Less can also be compiled to be permanently in "secure" mode.
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement