QB64.org Forum
Active Forums => Programs => Topic started by: FilipeEstima on August 03, 2019, 01:39:10 pm
-
Hi guys! I'm back.
I need to know 2 things: how can I upload a file to a VPS, and how to delete it later. I already know how to download a file, which is fairly simple as it doesn't require anything special with login and password, but in the case of upload and delete, it's a bit more complicated. How's it done?
-
I have PuTTY here, so it allows me to use pscp.exe but I can't call it from a QB64 program because the command only contains the user info, not the password, which is asked later. I don't know if it's possible to send a one-line command where everything is included. Something like this pseudo code:
SEND file.txt TO user:password@120.60.30.15:/remote_folder
-
I have PuTTY here, so it allows me to use pscp.exe but I can't call it from a QB64 program because the command only contains the user info, not the password, which is asked later. I don't know if it's possible to send a one-line command where everything is included. Something like this pseudo code:
SEND file.txt TO user:password@120.60.30.15:/remote_folder
Isn’t it a case of:
putty.exe mylogin@somewhere.com -pw mypassword
OR
putty.exe somewhere.com -l mylogin -pw mypassword
If you want to connect using SSH, use this:
putty.exe -ssh root@somewhere.com -pw mypasswordforsomewherecom
-
pscp -pw yourPasswordHere C:\Users\testUser\Downloads\test.sh testUser@123.123.123.123:/home/testUser
pscp -pw (your password) (FILE) (WHERE) — as indicated above
-
Hi Sam,
The examples you showed bring up the PuTTY console already logged to the VPS. I should then manually type a command to send the desired file to the VPS. What I want is a way to automatically send a file from my PC to the VPS, preferably without having to open the console, just in a single line if at all possible. My plan is to include such line inside my QB64 program.
I already have a QB64 program that regularly downloads a file that contains progress and status of an ongoing task being performed in a VPS (it's written in PHP and JS, not by me though). Sometimes this task freezes - I know because of time stamp printed on that status file - and my plan is to send a new file to the VPS, therefore allowing the task to continue. The program will have to be able to delete the remote file, then upload a substitute, without user intervention.
-
pscp -pw yourPasswordHere C:\Users\testUser\Downloads\test.sh testUser@123.123.123.123:/home/testUser
pscp -pw (your password) (FILE) (WHERE) — as indicated above
I will try that right now!
-
It worked, just as I wanted. Thanks, Sam! Trying to figure out how to delete the remote file now. It doesn't show how in options:
PuTTY Secure Copy client
Release 0.71
Usage: pscp [options] [user@]host:source target
pscp [options] source [source...] [user@]host:target
pscp [options] -ls [user@]host:filespec
Options:
-V print version information and exit
-pgpfp print PGP key fingerprints and exit
-p preserve file attributes
-q quiet, don't show statistics
-r copy directories recursively
-v show verbose messages
-load sessname Load settings from saved session
-P port connect to specified port
-l user connect with specified username
-pw passw login with specified password
-1 -2 force use of particular SSH protocol version
-4 -6 force use of IPv4 or IPv6
-C enable compression
-i key private key file for user authentication
-noagent disable use of Pageant
-agent enable use of Pageant
-hostkey aa:bb:cc:...
manually specify a host key (may be repeated)
-batch disable all interactive prompts
-no-sanitise-stderr don't strip control chars from standard error
-proxycmd command
use 'command' as local proxy
-unsafe allow server-side wildcards (DANGEROUS)
-sftp force use of SFTP protocol
-scp force use of SCP protocol
-sshlog file
-sshrawlog file
log protocol details to a file
-
PSCP does not support deleting a file. psftp does. See the pscp download page to download psftp.
-
https://the.earth.li/~sgtatham/putty/0.72/htmldoc/Chapter6.html#psftp-option-b
-
I did it with:
SHELL _HIDE "psftp login@123.123.123.123 -pw mypassword -b script.txt"
And inside script.txt:
cd /var/www/html
del file.txt
Thanks a ton, Sam.
-
Wait, I thought Sam was Pete! :D
-
Wait, I thought Sam was Pete! :D
I just figured it was an abbreviation for Steve’s Awesome, Man! :D
-
Ooooooh ya carnsarn idjits haz me so confusicated, I'z can't evens shoot straight!!!
- Sam... I means Pete... I means...
-
I just figured it was an abbreviation for Steve’s Awesome, Man! :D
Wait, is your name Steve? I'm sorry, I thought it was Sam McNeill, my mistake LOL