diff --git a/ChangeLog b/ChangeLog index 952502c..325856d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +btrbk-current + + * Added configuration option "ssh_port" (close: #39). + btrbk-0.19.3 * Bugfix: fix sorting of dates in schedule(). diff --git a/btrbk b/btrbk index f53384c..1b5e1ed 100755 --- a/btrbk +++ b/btrbk @@ -75,6 +75,7 @@ my %config_options = ( btrfs_commit_delete => { default => undef, accept => [ "after", "each", "no" ] }, ssh_identity => { default => undef, accept_file => { absolute => 1 } }, ssh_user => { default => "root", accept_regexp => qr/^[a-z_][a-z0-9_-]*$/ }, + ssh_port => { default => "default", accept => [ "default" ], accept_numeric => 1 }, btrfs_progs_compat => { default => undef, accept => [ "yes", "no" ] }, # deprecated options @@ -226,13 +227,14 @@ sub vinfo($$) if($url =~ /^ssh:\/\/(\S+?)(\/\S+)$/) { my ($host, $path) = ($1, $2); + my $ssh_port = config_key($config, "ssh_port"); my $ssh_user = config_key($config, "ssh_user"); my $ssh_identity = config_key($config, "ssh_identity"); my @ssh_options; + push(@ssh_options, '-p', $ssh_port) if($ssh_port ne "default"); if($ssh_identity) { - @ssh_options = ('-i', $ssh_identity); - } - else { + push(@ssh_options, '-i', $ssh_identity); + } else { WARN "No SSH identity provided (option ssh_identity is not set) for: $url"; } %info = ( @@ -243,6 +245,7 @@ sub vinfo($$) RSH_TYPE => "ssh", SSH_USER => $ssh_user, SSH_IDENTITY => $ssh_identity, + SSH_PORT => $ssh_port, RSH => ['/usr/bin/ssh', @ssh_options, $ssh_user . '@' . $host ], ); } @@ -283,6 +286,7 @@ sub vinfo_child($$) RSH_TYPE SSH_USER SSH_IDENTITY + SSH_PORT RSH BTRFS_PROGS_COMPAT ) ) { diff --git a/btrbk.conf.example b/btrbk.conf.example index 69cea58..76be6c3 100644 --- a/btrbk.conf.example +++ b/btrbk.conf.example @@ -51,6 +51,7 @@ snapshot_dir _btrbk_snap # Specify SSH private key for "ssh://" volumes / targets: #ssh_identity /etc/btrbk/ssh/id_ed25519 #ssh_user root +#ssh_port default # Don't wait for transaction commit on deletion. Set this to "after" # or "each" to make sure the deletion of subvolumes is committed to diff --git a/doc/btrbk.conf.5 b/doc/btrbk.conf.5 index 87b4ff3..965aaaa 100644 --- a/doc/btrbk.conf.5 +++ b/doc/btrbk.conf.5 @@ -116,6 +116,10 @@ Remote username for ssh. Defaults to \[lq]root\[rq]. Note that you will have to make sure that the remote user is able to run /sbin/btrfs (which needs root privileges). .TP +\fBssh_port\fR +Port to connect to on the remote host. Defaults to \[lq]default\[rq] +(the port specified in \fIssh_config\fR, which defaults to 22). +.TP \fBbtrfs_commit_delete\fR after|each|no If set, make sure the deletion of snapshot and backup subvolumes are committed to disk when btrbk terminates. Defaults to \[lq]no\[rq].