Serge
Serge

Reputation: 371

How to send files over SSH/SCP to Google Drive?

We have Centos, there is a directory with sql backups. How we can send those backups to Google Drive using cron schedule?

Upvotes: 34

Views: 54022

Answers (3)

asuagar
asuagar

Reputation: 1

I was able to do it thanks to the paramiko package:

!pip install paramiko
import paramiko

ssh = paramiko.SSHClient()
# automatically add keys without requiring human intervention
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(url, port, username, password)
ftp_client = ssh.open_sftp()
ftp_client.get('/home/covam/CEMAI/data/results/output1805to0206_rawShiptype.csv', 'data.csv')
ftp_client.close()
ssh.close()

Upvotes: -3

bikram
bikram

Reputation: 7985

The hack is to use Google Colab then mount google drive to it. After that, you can use ssh to access google collab file system as well as access mounted google drive.

I have written a python notebook here and tried it with success. https://gist.github.com/bikcrum/f9d4cfb0c40dff23329b89cd664d4964

Upvotes: 8

dovidweisz
dovidweisz

Reputation: 1234

GDCP should work as long as you authenticate the user for cron with the interactive cli.

https://github.com/ctberthiaume/gdcp

... I am using this now to transfer thousands of mp3 files from a ubuntu vps to google drive.

Upvotes: 5

Related Questions