LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-24-2006, 08:21 PM   #1
jantman
Member
 
Registered: Nov 2005
Location: New Jersey, USA
Distribution: SuSE
Posts: 492

Rep: Reputation: 31
SFTP in shell script


Hello,

I would like to use a shell script to put a file ("filename") to a remote server. Let's call it 0.0.0.0, "username", "password".

Can anyone give me a one-line shell script entry to put filename (in the current directory) to 0.0.0.0 using "username" and "password" and drop it in /home/username/filename

Thanks,
Jason
 
Old 11-24-2006, 09:13 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
You can't, unless you use expect (in which case it won't be a one-liner) or
you use password-less authentication (which should be the preferred option).



Cheers,
Tink
 
1 members found this post helpful.
Old 11-27-2006, 09:07 PM   #3
jantman
Member
 
Registered: Nov 2005
Location: New Jersey, USA
Distribution: SuSE
Posts: 492

Original Poster
Rep: Reputation: 31
Hmmm... I guess it's time to brush up on (or should I say learn) expect. Was always looking for a reason...
 
Old 11-27-2006, 10:12 PM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
If you set up ssh public key authentication (or are prepared to type in th password), you can use scp like this:
Code:
scp local_file_to_copy remoteuser@0.0.0.0:/path/to/put/file
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Allowing sftp without giving a shell koningshoed Linux - Security 8 12-14-2005 08:23 PM
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM
sftp over shell script naughtymutt Linux - General 1 08-20-2004 05:56 AM
sftp script error JeRrYmAn Linux - Networking 1 11-27-2003 07:21 PM
using sftp without having a Shell on serverside macone Linux - Security 4 08-09-2002 07:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration