22

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?

11

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
23

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.

  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.