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?

Germar commented 7 years ago

Are you running BiT as root? If so, you need to run those commands (ssh-keygen and ssh-copy-id) as root, too.

Alternative you can checkout the new 1.2.0 alpha which will do everything automatically:

sudo add-apt-repository ppa:bit-team/testing
sudo apt-get update
sudo apt-get upgrade
afettouhi commented 7 years ago

No I am running it as my normal user. So do I need to setup ssh-keygen and ssh-copy-id with the same passphrase on root as well then? BTW what cipher is the fastest?

Germar commented 7 years ago

Nope. You don't need to do anything as root if you're running BiT only as normal user.

Please run backintime-qt4 --debug from Terminal, configure it again in Settings and post the output from Terminal here. Also post the full error message you get after configuring.

afettouhi commented 7 years ago

Here is the output from the terminal when trying to set up a new profile with ssh


[af@andre ~]$ backintime-qt4 --debug
DEBUG: [common/backintime.py:509 arg_parse] Arguments: {'debug': True} | unknownArgs: []

Back In Time
Version: 1.1.12

Back In Time comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type `backintime --license' for details.

DEBUG: [common/backintime.py:576 getConfig] config file: /home/af/.config/backintime/config
DEBUG: [common/backintime.py:577 getConfig] profiles: ['1']
DEBUG: [common/pluginmanager.py:88 PluginManager.load_plugins] Register plugin path /usr/share/backintime/plugins
DEBUG: [common/pluginmanager.py:104 PluginManager.load_plugins] Add plugin qt4plugin.py
DEBUG: [common/pluginmanager.py:104 PluginManager.load_plugins] Add plugin notifyplugin.py
DEBUG: [common/pluginmanager.py:104 PluginManager.load_plugins] Add plugin userscriptsplugin.py
DEBUG: [common/snapshots.py:947 Snapshots.has_old_snapshots] Found old snapshots: False
DEBUG: [common/tools.py:613 keyring_supported] Found appropriate keyring 'keyring.backends.SecretService'
DEBUG: [common/mount.py:50 Mount.__init__] pw-cache is not running
DEBUG: [common/mount.py:59 Mount.__init__] Call command: /usr/bin/backintime pw-cache start
DEBUG: [common/tools.py:613 keyring_supported] Found appropriate keyring 'keyring.backends.SecretService'
DEBUG: [common/tools.py:613 keyring_supported] Found appropriate keyring 'keyring.backends.SecretService'
DEBUG: [common/tools.py:613 keyring_supported] Found appropriate keyring 'keyring.backends.SecretService'
DEBUG: [common/configfile.py:476 Config.set_current_profile] change current profile: 2
DEBUG: [common/tools.py:613 keyring_supported] Found appropriate keyring 'keyring.backends.SecretService'
DEBUG: [common/mount.py:50 Mount.__init__] pw-cache is not running
DEBUG: [common/mount.py:59 Mount.__init__] Call command: /usr/bin/backintime pw-cache start
DEBUG: [common/sshtools.py:192 SSH.unlock_ssh_agent] Add private key /home/af/.ssh/id_rsa to ssh agent
DEBUG: [common/sshtools.py:197 SSH.unlock_ssh_agent] Password available: True           
DEBUG: [common/sshtools.py:213 SSH.unlock_ssh_agent] Provide password through temp FIFO 
DEBUG: [common/sshtools.py:374 SSH.check_ping_host] Check ping host                     
DEBUG: [common/sshtools.py:383 SSH.check_ping_host] Host freenas is available
DEBUG: [common/sshtools.py:248 SSH.check_fuse] Check fuse
DEBUG: [common/sshtools.py:179 SSH.unlock_ssh_agent] Remove private key /home/af/.ssh/id_rsa from ssh agent
DEBUG: [common/sshtools.py:192 SSH.unlock_ssh_agent] Add private key /home/af/.ssh/id_rsa to ssh agent
DEBUG: [common/sshtools.py:197 SSH.unlock_ssh_agent] Password available: True
DEBUG: [common/sshtools.py:213 SSH.unlock_ssh_agent] Provide password through temp FIFO
DEBUG: [common/sshtools.py:323 SSH.check_known_hosts] Check known hosts file
DEBUG: [common/sshtools.py:330 SSH.check_known_hosts] Host freenas was found in known hosts file
DEBUG: [common/sshtools.py:270 SSH.check_login] Check login
Permission denied (publickey,password).
DEBUG: [common/configfile.py:476 Config.set_current_profile] change current profile: 1
DEBUG: [common/tools.py:613 keyring_supported] Found appropriate keyring 'keyring.backends.SecretService'
DEBUG: [common/mount.py:50 Mount.__init__] pw-cache is not running
DEBUG: [common/mount.py:59 Mount.__init__] Call command: /usr/bin/backintime pw-cache start
Germar commented 7 years ago

Okay, there is a Permission denied. Please run the command manually in Terminal to see what went wrong and post the output again:

ssh -o ServerAliveInterval=240 -o LogLevel=Error -o IdentityFile=/home/af/.ssh/id_rsa -o PreferredAuthentications=publickey -p 22 freenasuser@freenas echo "Hello"
afettouhi commented 7 years ago

Will try that when I get home tonight.

afettouhi commented 7 years ago

Output

[af@andre ~]$ ssh -o ServerAliveInterval=240 -o LogLevel=Error -o IdentityFile=/home/af/.ssh/id_rsa -o PreferredAuthentications=publickey -p 22 freenasuser@freenas echo "Hello" Permission denied (publickey,password).

Germar commented 7 years ago

So your public key is not installed correctly on the remote host. What does

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

say?

afettouhi commented 7 years ago

Here's the output

[af@andre ~]$ ssh-copy-id -i /home/af/.ssh/id_rsa.pub freenasuser@freenas
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/af/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
freenasuser@freenas's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'freenasuser@freenas'"
and check to make sure that only the key(s) you wanted were added.
Germar commented 7 years ago

Okay, so the key wasn't installed yet. Does it work now?

afettouhi commented 7 years ago

No, still doesn't work. I executed that command originally already when I setup my account ssh-mode as described in the manpage for backintime.

Germar commented 7 years ago

Hmm, looks like ssh-copy-id doesn't work with FreeNAS. Please copy and install the key manually:

scp /home/af/.ssh/id_rsa.pub freenasuser@freenas:./
ssh freenasuser@freenas
cat id_rsa.pub >> .ssh/authorized_keys
rm id_rsa.pub
exit

If you're still not able to login without password run the command again with verbosity and post the output:

ssh -vvv -o ServerAliveInterval=240 -o LogLevel=Error -o IdentityFile=/home/af/.ssh/id_rsa -o PreferredAuthentications=publickey -p 22 freenasuser@freenas echo "Hello"
afettouhi commented 7 years ago

Doesn't work either. Here is the verbose output

[af@andre ~]$ scp /home/af/.ssh/id_rsa.pub freenasuser@freenas:./
freenasuser@freenas's password: 
id_rsa.pub                                            100%  390     1.8MB/s   00:00    
[af@andre ~]$ ssh freenasuser@freenas
freenasuser@freenas's password: 
Last login: Mon Nov 21 20:14:24 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 ~]$ cat id_rsa.pub >> .ssh/authorized_keys
[freenasuser@freenas ~]$ rm id_rsa.pub
[freenasuser@freenas ~]$ exit
logout
Connection to freenas closed.
[af@andre ~]$ ssh -vvv -o ServerAliveInterval=240 -o LogLevel=Error -o IdentityFile=/home/af/.ssh/id_rsa -o PreferredAuthentications=publickey -p 22 freenasuser@freenas echo "Hello"
OpenSSH_7.3p1, OpenSSL 1.0.2j  26 Sep 2016
debug1: Reading configuration data /home/af/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolving "freenas" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to freenas [192.168.0.15] port 22.
debug1: Connection established.
debug1: identity file /home/af/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/af/.ssh/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2 FreeBSD-20160310
debug1: match: OpenSSH_7.2 FreeBSD-20160310 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to freenas:22 as 'freenasuser'                                   
debug3: hostkeys_foreach: reading file "/home/af/.ssh/known_hosts"                      
debug3: record_hostkey: found key type ECDSA in file /home/af/.ssh/known_hosts:5        
debug3: load_hostkeys: loaded 1 keys from freenas
debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,3des-cbc
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,3des-cbc
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com,zlib
debug2: compression stoc: none,zlib@openssh.com,zlib
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ssh-dss,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none
debug2: compression stoc: none
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:ZggWgHoAVODNNr7ysbqhaSWJIhW5JKBoHGKPG9tQUWI
debug3: hostkeys_foreach: reading file "/home/af/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/af/.ssh/known_hosts:5
debug3: load_hostkeys: loaded 1 keys from freenas
debug3: hostkeys_foreach: reading file "/home/af/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/af/.ssh/known_hosts:4
debug3: load_hostkeys: loaded 1 keys from 192.168.0.15
debug1: Host 'freenas' is known and matches the ECDSA host key.
debug1: Found key in /home/af/.ssh/known_hosts:5
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug2: set_newkeys: mode 0
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug2: key: /home/af/.ssh/id_rsa (0x5621e49dfec0), explicit
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred publickey
debug3: authmethod_lookup publickey
debug3: remaining preferred: 
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/af/.ssh/id_rsa
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey,password).
Germar commented 7 years ago

Hmm, still not very helpful...

Maybe permissions of remote ~/.ssh/authorized_keys file are wrong. SSHd is quite picky for a good reason on this. Please try to fix them manually:

ssh freenasuser@freenas
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
afettouhi commented 7 years ago

Tried to fix the permissions as you suggested still the same error.

afettouhi commented 7 years ago

I am a bit of a loss here now on what do to other than setting up the profile to the freenas server without ssh and go through cifs instead.

Germar commented 7 years ago

Oh, sorry mate. I wanted to try this my self this weekend. Already downloaded the FreeNAS image. But weekend was to busy to proceed. Give me couple days and I'll try to troubleshoot this

afettouhi commented 7 years ago

No problem.

Germar commented 7 years ago

Okay, I played a bit with FreeNAS. First of all, it worked out of the box here. No problems at all. But I think, I was able to reproduce your problem. Please check permissions of your users home. It should look like this in users preferences:

bildschirmfoto vom 2016-11-29 21-55-02

afettouhi commented 7 years ago

OK, I will try to take a look and see if that gets it to work. I may have forgotten to add my freenasuser to the auxiliary group so it doesn't have su access. Hence, the permission issues, maybe!

Germar commented 7 years ago

The group doesn't matter. The Permission (Home Directory Mode) is important.

afettouhi commented 7 years ago

OK, then I don't understand why I get the error then because in the "HOME Directory Mode" everything is ticked off.

Germar commented 7 years ago

😂😂😂 that's exactly the problem. Please activate them like they are in my screenshot above

afettouhi commented 7 years ago

OK, I'll try that.

afettouhi commented 7 years ago

Well, I tried what you suggested and I get the same error. Here is the gui:

screenshot_20161130_202539

I noticed that when I edited my freenasuser account it complained about not having write access to the home directory (claims write protected) and I had to delete ssh key in the field inorder to make the change.

afettouhi commented 7 years ago

Getting this error now with backintime and setting up ssh

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

Germar commented 7 years ago

Please login to your NAS and post the output of these commands:

ssh freenasuser@freenas
ls -laR ~
ls -la /mnt/freenaspool/Media

There must still be some permission problems

afettouhi commented 7 years ago

Here's the output

[af@andre ~]$ ssh freenasuser@freenas
Enter passphrase for key '/home/af/.ssh/id_rsa': 
Last login: Fri Nov 25 19:23:58 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 ~]$ ls -laR ~
total 17
drwxr-xr-x   3 freenasuser  freenasgroup    13 Nov 24 19:28 .
drwxr-xr-x  20 root         wheel           27 Nov 25 19:56 ..
-rw-------   1 freenasuser  freenasgroup   118 Nov 25 19:24 .bash_history
-rw-r--r--   1 freenasuser  freenasgroup   994 Nov 12 15:45 .cshrc
-rw-------   1 freenasuser  freenasgroup  1660 Nov 20 21:35 .history
-rw-r--r--   1 freenasuser  freenasgroup   186 Nov 12 15:45 .login
-rw-r--r--   1 freenasuser  freenasgroup    91 Nov 12 15:45 .login_conf
-rw-------   1 freenasuser  freenasgroup   301 Nov 12 15:45 .mail_aliases
-rw-r--r--   1 freenasuser  freenasgroup   267 Nov 12 15:45 .mailrc
-rw-r--r--   1 freenasuser  freenasgroup   743 Nov 12 15:45 .profile
-rw-------   1 freenasuser  freenasgroup   212 Nov 12 15:45 .rhosts
-rw-r--r--   1 freenasuser  freenasgroup   909 Nov 12 15:45 .shrc
drwx------   2 freenasuser  freenasgroup     3 Nov 30 21:04 .ssh

/nonexistent/.ssh:
total 4
drwx------  2 freenasuser  freenasgroup    3 Nov 30 21:04 .
drwxr-xr-x  3 freenasuser  freenasgroup   13 Nov 24 19:28 ..
-rw-------  1 freenasuser  freenasgroup  390 Nov 30 21:04 authorized_keys
[freenasuser@freenas ~]$ ls -la /mnt/freenaspool/Media
total 167
drwxrwxr-x+  8 freenasuser  freenasgroup   9 Nov 30 21:21 .
drwxr-xr-x   4 root         wheel          4 Nov 19 14:40 ..
-rw-r--r--   1 root         wheel          0 Nov 12 20:17 .windows
drwxrwxr-x+ 18 freenasuser  freenasgroup  18 Nov 13 09:47 Anime Movies
drwxrwxr-x+ 53 freenasuser  freenasgroup  53 Nov 13 14:08 Anime TV Shows                
drwxrwxr-x+ 35 freenasuser  freenasgroup  35 Nov 13 08:51 Movies                        
drwxrwxr-x+  5 freenasuser  freenasgroup   6 Nov 13 21:32 Music                         
drwxrwxr-x+ 34 freenasuser  freenasgroup  34 Nov 13 19:46 TV Shows
Germar commented 7 years ago

Permissions looks good. Please make sure, your freenasuser has set Shell to bash in settings

bildschirmfoto vom 2016-11-30 21-49-17

afettouhi commented 7 years ago

I have already done that. Under Home Dorectpry I have

/nonexistent

could that be the issue?

Germar commented 7 years ago

Sure, that would point to a path which does not exist and so it can't save the ssh public key. I'd advice to create a /mnt/freenaspool/Media/home folder for all users homes and set freenasusers home to /mnt/freenaspool/Media/home/freenasuser

Germar commented 7 years ago

But on the other hand you have a home like shown above 🤔

afettouhi commented 7 years ago

Tried this to with the home directory back to the old error from before

Germar commented 7 years ago

So you need to fix permissions of the new home again

afettouhi commented 7 years ago

You mean this?

ssh freenasuser@freenas chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys

Germar commented 7 years ago

Nope. This:

bildschirmfoto vom 2016-11-29 21-55-02

and finally ssh-copy-id ...

afettouhi commented 7 years ago

Tried it still fails...

Germar commented 7 years ago

Please try again with a other new user on your FreeNAS using this steps:

Username: backupuser
create a new primary group for the user: True
Create Home Directory in: /mnt/freenaspool/Media/home/backupuser
Shell: bash
Full Name: what ever you want
Password and Password confirm: your Password

Next on your local machine type ssh-copy-id -i /home/af/.ssh/id_rsa.pub backupuser@freenas and change your BiT profile to User: backupuser and leave Path empty.

afettouhi commented 7 years ago

Still doesn't work even with a new user. Getting the Passwordless login backupuser@freenas failed.

Germar commented 7 years ago

Sorry, I'm out of ideas. It does work here. Please contact a FreeNAS support forum with the ssh-key and chmod problem.

afettouhi commented 7 years ago

OK, thanks for your help. I'll try over on theFreeNAS forum to see if they can help.

afettouhi commented 7 years ago

I have done these tests with backintime now on my Arch Linux machine. I have HP laptop running with Ubuntu 16.04. I am going test backintime and ssh backup onto my FreeNAS with that. Here I need to do initial steps again for this machine e.g.

ssh-keygen -t rsa

and finally

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

or will that override my ssh key from my desktop? How stable is the 1.2.0 alpha should upgrade to that? I have 1.1.2 installed on my Ubuntu laptop?

Germar commented 7 years ago

Yes, you need to do those steps again and they won't overwrite anything from your other machine.

1.2.0 is still alpha. I continue to add new features over time which can of course break something. But with 1.2.0 I now have a unit-test-suit which already revealed several bugs (which are fixed in 1.2.0) and will help to prevent future bugs, too. So I already use 1.2.0 in production and can still sleep well :wink:

afettouhi commented 7 years ago

I upgreaded my backintime on my Ubunrtu laptop to the 1.2.0 alpha build and I repeated the steps for the ssh key and copying it to the freenas server. I then started the GUI and I tried set up my profile for ssh but it keeps asking me to copy the ssh key to the freenas. If I say no nothing happens further, if I say yes it asks for the password on my freenas. I type it in and then it just again asks me to copy the ssh key.

Germar commented 7 years ago

Copy the key wasn't successful. At the moment BiT will just try again until it was successful. This is a new feature where I need to add more error handling dialogs

afettouhi commented 7 years ago

I hjave tried a bit more to figure out why this doesn't work for me. Remember that I initially hadn't recreated a home directory for my user on freenas. I tried fix the permissions on it as you suggested previously with

[af@andre ~]$ ssh freenasuser@freenas
freenasuser@freenas's password: 
Last login: Sat Dec  3 15:00:33 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 ~]$ chmod 700 ~/.ssh
chmod: /mnt/freenaspool/Media/home/freenasuser/.ssh: Operation not permitted
[freenasuser@freenas ~]$ chmod 600 ~/.ssh/authorized_keys
chmod: /mnt/freenaspool/Media/home/freenasuser/.ssh/authorized_keys: Operation not permitted
Germar commented 7 years ago

You doesn't own those folders so you can not change permissions. Please fix the ownership first with:

sudo chown freenasuser -R /mnt/freenaspool/Media/home/freenasuser/
sudo chgrp freenasgroup -R /mnt/freenaspool/Media/home/freenasuser/
afettouhi commented 7 years ago

Doesn't seem to work keeps complaining about

chown: -R: No such file or directory

and if I check the permissions

[freenasuser@freenas /mnt/freenaspool/Media/home]$ ls -l total 13 drwxrwxr-x+ 3 1002 1002 11 Dec 1 05:13 backupuser drwxrwxr-x+ 3 freenasuser freenasgroup 4 Dec 3 15:00 freenasuser

they are already set right it seems

Germar commented 7 years ago

-R is used to change all child files/folders, too. Your chown seems to not know that option. So you need to make that manually:

find /mnt/freenaspool/Media/home/freenasuser -exec chown freenasuser {} \;
find /mnt/freenaspool/Media/home/freenasuser -exec chgrp freenasgroup {} \;
afettouhi commented 7 years ago

I give up I simply can't get it to work no matter what I do. Constant complaining about permissions denied and everything is set to the user on freenas.