39

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?

2 Answers 2

32

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
0
30

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.

3
  • 1
    curious about the rationale behind ; - never seen a specific commenting style for disabled code (as opposed to text) before Commented Mar 26, 2015 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
    Commented Mar 26, 2020 at 3: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! :) Commented Jul 2, 2020 at 11:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .