Sftp,[put] all files that are .csv to server. Linux Ubuntu
Hello all,
I am trying to sftp files to a server, I am using keys as authentication and I can connect with no problems. I can also put a sample file on the server.
When I tried to automate this process with a .sh file I get the "couldn't canonicalize: Failure".
This shows that i connected with the -v debug and all keys are working.
My code to put the files then looks like this;
my files have been given the chmod
I am trying to put all files that have a .csv on the server.
What am I doing wrong?
Many thanks for any help you provide.
This is my first post so I hope I have been descriptive enough.
Last edited by vbe; 02-19-2018 at 02:59 PM..
Reason: code tags please for the code, not icode, thanks
Thanks for your replies, I have checked the permission on the key folder. It has chmod 700.
Here is the cron job that runs the code:
Here is the full script:
Using the same sftp line from my script connects to the server because debug shows the key verification process and says connected.
Basically, I need a script that will send any file with the .csv extension that is in the data folder, to the server each day at just after 5.
I also have another script which you can see referenced in the cronjob which is to create a log file with the date of transfer and file name sent, here that is:
The path ftpusers/TransferFolder/ftp/data/ is 2 folder levels below my users home path, e.g ~/. So I need to ../../ to then go to my ftpusers/TransferFolder/ftp/data/ ,path. will this affect the process?
Again, thank you for your time and answers
Moderator's Comments:
Thanks for trying, but: Please use CODE (not ICODE) tags as required by forum rules!
Last edited by RudiC; 02-20-2018 at 08:09 AM..
Reason: Changed ICODE to CODE tags.
are you trying to change directory in your local machine or your remote machine?
if you are changing in remote "cd" will work.
if you are trying to change locally, try "lcd"
try using absolute path starting from "/" example "/home/user/ftpusers/TransferFolder/ftp/data/*"
echo will not work inside FTP, need to use after EOF.
This looks good
Also please see below a version of script that worked for me.
The above script transfers all the files from dir "/home/localuser/files/" on the local machine to
"/home/remote_user/files" directory on the remote machine.
hope this helps.
Moderator's Comments:
Please use CODE (not HTML) tags as required by forum rules!
Last edited by RudiC; 02-20-2018 at 03:31 PM..
Reason: Changed HTML to CODE tags.
Hi,
I am looking for a shell script to sftp to a file server and copy all the files from a directory after the script is run.
The server name should be a user input parameter and of-course the username/password as well. Rest all should be handled by the script.
I tried with below snippet:-
... (1 Reply)
Hi,
I am trying to automate the process of fetching files from remote server to local server through sftp. I have the username and password for the remote solaris server. But I need to give password manually everytime i run the script.
Can anyone help me in automating the script such that it... (3 Replies)
I am having two csv files i need to compare these files and the output file should have the information of the differences at the field level.
For Example,
File 1:
A,B,C,D,E,F
1,2,3,4,5,6
File 2:
A,C,B,D,E,F
1,2,4,5,5,6
out put file: (12 Replies)
hi
i need to transfer some files from windows server to unix server using SFTP. but before transferring the files, i need to check the
existence of a particular file in the remote directory (say r_dir1). if the file is present, then SFTP all the files.
after SFTPing the files from the remote... (1 Reply)
Hi all,
I have no root access enabled on our linux server due to safety issues. We use sudo. When I change my password using passwd command, I sometimes get issues where I can't log back in.
Pam_Tally disables due to trying my password too many times. So someone in my group has to reset... (7 Replies)
Hi,
we have a big problem,
history:
we migrated our companies ftp and sftp-server, which were vsftp and openssh, to one server, software is called JSCAPE ftp server professional edition
for the first time everything was great, but after one or two months, our uploads hang, 0 byte files are... (11 Replies)
I have tried winscp, filezilla to copy data from windows xp SP2 machine to the sun sparc unix machine. However speed is around 120 to 130 kb/sec. I do have lot of files & with large size.
So I switched to windows command prompt & transfered few files using sftp command. Its very fast as compared... (0 Replies)