$host = 'localhost',
$hostport,
$remote_host,
+ $remote_user = 'absent',
$monitor_port = 'absent',
$gatetime = 'absent',
$first_poll = 'absent',
include autossh
+ $real_remote_user = $remote_user ? {
+ 'absent' => $user,
+ default => $remote_user,
+ }
+
# According to the autossh documentation, using OpenSSH ServerAlive
# options is better than using a monitor port, so we do that by default.
if ($monitor_port == 'absent') {
#
# AutoSSH configuration
#
-AUTOSSH_ARGS="-M <%= real_monitor_port %> -N -L <%= bind_address %>:<%= port %>:<%= host %>:<%= hostport %> <%= ssh_extra_options %> <%= remote_host %>"
+AUTOSSH_ARGS="-M <%= real_monitor_port %> -N -L <%= bind_address %>:<%= port %>:<%= host %>:<%= hostport %> <%= ssh_extra_options %> <%= real_remote_user %>@<%= remote_host %>"
<% if gatetime != 'absent' -%>
AUTOSSH_GATETIME=<%= gatetime %>
<% end -%>