37

Is it possible to put comments in the client config files (those in the path specified by "client-config-dir") for OpenVPN, i.e. something beginning with "#" or "//" or the like? If so, what is the appropriate comment character?

Doktor J
  • 1,087
  • 1
  • 10
  • 20

2 Answers2

29

The '#' prefix is the designated comment tag. The examples on the openvpn website use '#' comments extensively.

Also, the semi-colon - ';' - is used to comment out single lines or items.

Jim G.
  • 2,607
  • 1
  • 18
  • 19
  • 1
    curious about the rationale behind `;` - never seen a specific commenting style for disabled code (as opposed to text) before – Peter Ehrlich Mar 26 '15 at 18:33
  • In editors that colorize text, lines with `#` are often colored using the 'comment' color, while most will not add a color to the lines starting with `;`, making them easier to see. – orev Mar 26 '20 at 03:48
  • @PeterEhrlich, PDP-11 Macro assembler, all(?) x86 assemblers and many microprocessor assemblers (e.g., PIC), all languages in the Lisp family (Common Lisp, Scheme, Elisp), and Clojure use (or used to use) the `;` to EOL for comments. Windows .ini files also do. I'm probably showing my age… But it could have been worse: BASIC and Windows batch scripts use `REM` for comments (from the 'remark'), and Algol family used the keyword `comment`, no less, for (potentially multiline) comments until the `;` terminator. And APL… please google it, oh my puny keyboard… well, just google it up! :) – kkm Jul 02 '20 at 11:12
29

As Jim says the examples on the OpenVPN site use # for comments and ; to comment out settings. There is no functional difference but this convention makes it easier to visually identify settings that are commented out.

From https://openvpn.net/index.php/open-source/documentation/howto.html#examples

#################################################
# Sample OpenVPN 2.0 config file for            #
<snip>
# Comments are preceded with '#' or ';'         #
#################################################

# Which local IP address should OpenVPN
# listen on? (optional)
;local a.b.c.d

# Which TCP/UDP port should OpenVPN listen on?
# If you want to run multiple OpenVPN instances
# on the same machine, use a different port
# number for each one.  You will need to
# open up this port on your firewall.
port 1194

# TCP or UDP server?
;proto tcp
proto udp
John Ball
  • 481
  • 4
  • 3