How can I upload files to FreeNas usign ftp

yefersoncm

Cadet
Joined
Dec 28, 2018
Messages
7
Hi I'm new in this world of Nas, so apologize if this is not the right topic.

I have a server with CentOS and I am creating a backup of my postgres database periodically and I just need to upload the copy to my NAS using ftp protocol but I am unable to connect, I already activate the service on the nas but nothing

This is the code I am using

lftp -u 'user','password' -e "cd /copiaDB/;mput /copias/copia_db.tar.gz; quit" 192.168.0.253

Please if is there something wrong please let me know I am desperate :(

Thanks in advance
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504

yefersoncm

Cadet
Joined
Dec 28, 2018
Messages
7
"Nothing" isn't very helpful. What exactly is happening?
Sorry, this is the message that I get.

cd: Falló la identificación con el servidor: 530 Login incorrect.
mput: Falló la identificación con el servidor: 530 Login incorrect.

the thing is that the login and password is correct
 

yefersoncm

Cadet
Joined
Dec 28, 2018
Messages
7
If I use lftp -u root,password 192.168.0.253 the console shows this lftp root@192.168.0.253:~> Does that means that I am loged in?
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Does that means that I am loged in?
It would appear so, though I'm not familiar with lftp. But having reached that point, can you then do the cd and mput commands that you're trying to do in the script?
 

yefersoncm

Cadet
Joined
Dec 28, 2018
Messages
7
It would appear so, though I'm not familiar with lftp. But having reached that point, can you then do the cd and mput commands that you're trying to do in the script?

I was checking and I found out that I am not loged in yet. Using wrong user and password still show something like this lftp wronguser@wrongipaddres:~>

So I am no getting connected with lftp, but if you know another way to do what I want please let me know

I have this in my server


DATE=`date +%G-%m-%d_%H.%M`

echo $DATE

/usr/pgsql-9.2/bin/pg_dump -U admin SIIS> /copias/SIIS_$DATE.sql

echo "extraccion de base de datos OK...."

tar -czvf /copias/copia_$DATE.tar.gz /copias/SIIS_$DATE.sql


In this way I am getting the copy of my database in a tar.gz so I need to move that copy to another machine, my freenas build

Is there a way that I can move the file?

Sorry Im new in this and also new in unix systems and I am trying my best.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Is there a way that I can move the file?
Probably dozens of ways; the one that strikes me as the simplest would be using scp. Here's how that would work:
  • Turn on the SSH service on your FreeNAS box
  • On your CentOS box, as the user that will be running the backup script, run ssh-keygen. Don't set a password for the private key.
  • Again on the CentOS box, cat ~/.ssh/id_rsa.pub
  • On the FreeNAS box, create a user. Set that user's home directory to be somewhere on your pool with Unix permissions, and paste in the contents of id_rsa.pub in the SSH Public Key field. You can also do this by editing an existing user and pasting in the public key there.
  • Set the permissions on whatever dataset you want to store the backups such that the user you just created can write there.
  • Then the command go in your script would be scp /copias/copia_$DATE.tar.gz user@freenas_ip:/path/to/copias/
 

yefersoncm

Cadet
Joined
Dec 28, 2018
Messages
7
Probably dozens of ways; the one that strikes me as the simplest would be using scp. Here's how that would work:
  • Turn on the SSH service on your FreeNAS box
  • On your CentOS box, as the user that will be running the backup script, run ssh-keygen. Don't set a password for the private key.
  • Again on the CentOS box, cat ~/.ssh/id_rsa.pub
  • On the FreeNAS box, create a user. Set that user's home directory to be somewhere on your pool with Unix permissions, and paste in the contents of id_rsa.pub in the SSH Public Key field. You can also do this by editing an existing user and pasting in the public key there.
  • Set the permissions on whatever dataset you want to store the backups such that the user you just created can write there.
  • Then the command go in your script would be scp /copias/copia_$DATE.tar.gz user@freenas_ip:/path/to/copias/
I will try this and I will let you know if works.

Thanks!
 
Top