summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbyteback-setup-client2
-rwxr-xr-xbyteback-setup-client-receive5
-rwxr-xr-xsudoers.d/byteback1
3 files changed, 6 insertions, 2 deletions
diff --git a/byteback-setup-client b/byteback-setup-client
index afcbee4..fb3838a 100755
--- a/byteback-setup-client
+++ b/byteback-setup-client
@@ -60,6 +60,6 @@ key_pub = File.read("/etc/byteback/key.pub").chomp
error "Remote setup didn't work" unless
system("ssh -i /etc/byteback/key -l #{@destination_user} #{@destination_host} byteback-setup-client-receive #{@hostname} #{key_pub}")
-File.open("/etc/byteback/host", "w") { |f| f.print @destination }
+File.open("/etc/byteback/destination", "w") { |f| f.print @destination }
print "Setup worked! To take your first backup run: byteback-backup --verbose\n"
diff --git a/byteback-setup-client-receive b/byteback-setup-client-receive
index 79df12b..d98eab2 100755
--- a/byteback-setup-client-receive
+++ b/byteback-setup-client-receive
@@ -32,6 +32,9 @@ Dir.mkdir(@hostname)
error("Couldn't create btrfs subvolume (needs sudo)") unless
system("sudo btrfs subvolume create #{@hostname}/current")
+error("Couldn't set ownership of new subvolume (need sudo)") unless
+ system("sudo chown byteback "+File.expand_path("#{@hostname}/current"))
+
FileUtils.mkdir_p(".ssh")
if File.exists?(".ssh/authorized_keys") &&
@@ -42,7 +45,7 @@ if File.exists?(".ssh/authorized_keys") &&
else
File.open(".ssh/authorized_keys", "a+") do |fh|
- fh.print <<-LINE.gsub(/\n/,"")
+ fh.print <<-LINE.gsub(/\n/,"") + "\n"
command="byteback-receive",
from="#{@client_ip}",
environment="BYTEBACK_HOST=#{@hostname}"
diff --git a/sudoers.d/byteback b/sudoers.d/byteback
index 5a5a39e..121769c 100755
--- a/sudoers.d/byteback
+++ b/sudoers.d/byteback
@@ -3,5 +3,6 @@
byteback ALL = (root) NOPASSWD: /usr/bin/byteback-snapshot
byteback ALL = (root) NOPASSWD: /sbin/btrfs subvolume create /store/backups/*/current
byteback ALL = (root) NOPASSWD: /sbin/btrfs subvolume delete /store/backups/*
+byteback ALL = (root) NOPASSWD: /bin/chown byteback /store/backups/*/current
Defaults:byteback !requiretty