SOLVED Rsync connecting from TrueNas SCALE to Linux servers

twinslavi

Cadet
Joined
Oct 21, 2022
Messages
4
Hello,
As company we are preparing to change our "backup" server, to something like TrueNas Scale. We want to backup several servers. Most of data that we want to backup are SQL dumps files and some exports of gps data saved in .csv type format.

Right now
We have based Debian server that has some cron jobs, that are running scripts, with some of Rsync tasks.
System is based on dell R720 with some dell PERC 310 controller running. I wont say its its bad, but maybe for now its enough but in 1y of time it will be non usable.

We want
To connect via Rsync tasks from Truenas to linux servers. But problem is that, Rsync don't come with 'sshpass' package. And for me connecting via GUI panel of truenas is hard. May somebody have made this kind of connection where Truenas is connecting to server, not Server to truenas. Why ?? Its much more save to have one machine as backup to connect to product servers rather production servers placed somewhere in world to connect main backup server based in our company, disconected from world access such as ssh.

Can somebody tell me how tu establish kinnda of connection from gui :)

Solution I made but don't consider is good.
I by passed apt access from shell of TrueNas and ofcourse i installed sshpass and everything is working as fine as i want. But i know, there is a reason to block apt access for truenas.
 

twinslavi

Cadet
Joined
Oct 21, 2022
Messages
4
I SOLVED my problem, hope in future other ppl will have less problems to do it.

Solution to Connect TRUENAS Scale -> Debian / Ubuntu Servers and work with RSYNC but from TrueNas Scale GUI.

1) First of all you need to make a User in GUI of TrueNas, choice a folder in /mnt where user will have full access. TrueNas will automaticly make a folder for this user named by user name.

2) Open any Terminal / Putty / CMD, and login to TrueNas via this user over SSH. Just to make some changes. If u can't login u probably didn't turn on ssh service so go into System Settings -> Services and turn on SSH.

3) After login to your user, create folder .ssh / mkdir .ssh if it wont be possible use sudo mkdir .ssh

4) Go into .ssh folder -> cd .ssh, and now u need to create 2 files, that will be responsible for connecting via SSH. You need to create rsa_id and rsa_id.pub

5) What about content of those files ? You need to generate ssh keys so u need to go to in Truenas Gui Credentials -> Backup Credentials and make new key in SSH KEYPAIRS.

6) Create keys, remember to name field add your created user name.

7) Generate keys, and content of them copy into created files in 4. So private key into rsa_id, and public key into rsa_id.pub

8) I need to change some ownerships so, what i did is I make a sudo chmod 600 rsa_id, and then i make chmod "username" rsa_id

After all of this steps i was able to create job in Rsync via GUI,
and i didn't need to use SSHPASS.
 

twinslavi

Cadet
Joined
Oct 21, 2022
Messages
4
UPDATE - I think there is a bug in TrueNas.

I create ssh-keys via GUI, and today i get to the point where i was confused. I tried to add new rsync job but i got message:
"invalid private key / error in importing private key"

I dig into public key and i sow, that when i generate key inside GUI, at the end of result of .pub i sow this:
root@truenas

In generate section of gui, in name space, i put name of my user, and i though that *name is responsible for name of user that this key will belong to. But i was wrong, gui generator at the end has ending root@truenas.

So today i tried to generate by ssh-keygen via ssh, and on end user i want to use for backups. And it worked correctly.

Hey if there is a bug in generator please update it :)
 
Top