Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i upload file by command line via sftp? [closed]

Tags:

I know how to get remote file via sftp.

ex:

sftp [email protected]:/path/to/file.txt localfile.txt 

How can i upload file to remote server?

(I need use this command in my bash script.)

like image 255
ss-t.c Avatar asked Jan 11 '14 02:01

ss-t.c


People also ask

How do I sftp from command prompt?

How to Connect to SFTP. By default, the same SSH protocol is used to authenticate and establish an SFTP connection. To start an SFTP session, enter the username and remote hostname or IP address at the command prompt. Once authentication is successful, you will see a shell with an sftp> prompt.

How do I close sftp?

Type 'exit' command where we can see sftp> prompt return.

How do you use GET and PUT command in sftp?

sftp> put – Upload file. sftp> get – Download file. sftp> cd path – Change remote directory to 'path' sftp> pwd – Display remote working directory.


1 Answers

Also think about using SSH public/private keys which can avoid you to have to enter a password for your automated file exchanges.

You can use the command "ssh-keygen" to generate those keys.

like image 89
HelpBox Avatar answered Oct 11 '22 09:10

HelpBox