bit-team / backintime

Back In Time - An easy-to-use backup tool for GNU/Linux using rsync in the back
https://backintime.readthedocs.io
GNU General Public License v2.0
2.05k stars 203 forks source link

Setting a new profile with SSH fails #664

Closed afettouhi closed 7 years ago

afettouhi commented 7 years ago

Well, I finally got my new FreeNAS 9.10 server up an running and I am in the process of setting up a new profile in the backintime GUI with SSH this time. I have set up access ssh on my freenas and turned it on. Then I followed what the man backintime page said, e.g. installed sshfs and added my user to the fuse group. Then I did

ssh-keygen -t rsa

and finally

ssh-copy-id -i ~/.ssh/id_rsa.pub freenasuser@freenas

then I went into the settings dialog entered everything as described but when I try to save the new profile it complains about not finding the freenasuser@freenas. What am I doing wrong?

afettouhi commented 7 years ago

When you tested FreeNAS what type of share did you set up?

Germar commented 7 years ago

No share at all. I just added one drive to pool of storage devices and made it writeable to the user.

afettouhi commented 7 years ago

Could you maybe try to make a smb share and see if it still works for you?

afettouhi commented 7 years ago

I think I am getting somewhere with this. I created a new dataset outside the smb share I have and I put my home direcotry of the freenasuser there. I now has unix permissions. Then I setup a new ssh key and copied it over to the freenas. Now if I try to set it up in the BiT UI I get this error

freenas not found in ssh_known_hosts.

Germar commented 7 years ago

Sorry, I'm quite busy at the moment so I was not able to test it with SMB share yet.

To add 'freenas' to your ssh_known_hosts file you simply need to login to freenas from Terminal with the user you are using for BiT.

afettouhi commented 7 years ago

I have made a new attempt getting this to work. I moved the home directory outside my smb share and made a new dataset for it under the pool I originally created. Then I have resetup the ssh key and copied it over to the freenas server. Now if I try to setup the profile in BiT UI I get

Remote host freenas doesn't support 'chmod u+rw FILE': chmod: /mnt/freenaspool/Media/tmp_QJNMZD/a: Operation not permitted

Note that I am still trying to place my backup in the smb share I have created, e.g.

/mnt/freenaspool/Media/

and I think that this causing the headache. I have also tried to place the backup in the new created dataset here I get

write permission denied.

Germar commented 7 years ago

I tried it with a new SMB share but it still works over here.

In FreeNAS web-admin please select: Storage > Volumes > /mnt/freenaspool/Media > Change Permissions

Change Owner (user) to freenasuser and Owner (group) to freenasgroup (or what ever username and main group you now want to use). In Mode activate all boxes for Read and Execute and the first and second box for Write. Also activate Set permission recursively and press Change. This should fix all permission problems...

afettouhi commented 7 years ago

So you have chosen Unix as permission type then? Because if it is set to Windows the Mode boxes are greyed out.

Germar commented 7 years ago

Yes! Permission Type need to be Unix! And make sure all Apply ... options are activated

afettouhi commented 7 years ago

Still fails with this error

Remote host freenas doesn't support 'chmod u+rw FILE': chmod: /mnt/freenaspool/Media/tmp_W293CO/a: Operation not permitted

Germar commented 7 years ago

What happens if you log in and change permissions manually:

ssh freenasuser@freenas
mkdir /mnt/freenaspool/Media/test
echo "foo" > /mnt/freenaspool/Media/test/a
chmod u+rw /mnt/freenaspool/Media/test/a

Alternative you can install current development version from ppa:bit-team/testing which won't need chmod anymore.

afettouhi commented 7 years ago

This happens:

[af@andre ~]$ ssh freenasuser@freenas
Enter passphrase for key '/home/af/.ssh/id_rsa': 
Last login: Tue Dec 13 20:33:29 2016 from 192.168.0.10
FreeBSD 10.3-STABLE (FreeNAS.amd64) #0 r295946+07c41cd(9.10-STABLE): Wed Nov  9 00:19:25 UTC 2016

        FreeNAS (c) 2009-2016, The FreeNAS Development Team
        All rights reserved.
        FreeNAS is released under the modified BSD license.

        For more information, documentation, help or support, go here:
        http://freenas.org
Welcome to FreeNAS
[freenasuser@freenas ~]$ mkdir /mnt/freenaspool/Media/test
[freenasuser@freenas ~]$ echo "foo" > /mnt/freenaspool/Media/test/a
[freenasuser@freenas ~]$ chmod u+rw /mnt/freenaspool/Media/test/a
chmod: /mnt/freenaspool/Media/test/a: Operation not permitted
Germar commented 7 years ago

Hmm, I don't get it. It does work over here. Do you have any special ACLs which do not permit this? What's the output of

getfacl /mnt/freenaspool/Media/test/a
afettouhi commented 7 years ago
[freenasuser@freenas ~]$ getfacl /mnt/freenaspool/Media/test/a
# file: /mnt/freenaspool/Media/test/a
# owner: freenasuser
# group: freenasgroup
            owner@:rwxpDdaARWcCos:------I:allow
            group@:rwxpDdaARWcCos:------I:allow
         everyone@:r-x---a-R-c---:------I:allow
afettouhi commented 7 years ago

I finally got it working. Seems like the permissions in my shares where messed up. So I tried to create afresh dataset via the FreeNAS GUI and make it my backup location. Then finally the BiT GUI accepted the path.