LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-01-2007, 02:07 AM   #1
Leb_CRX
LQ Newbie
 
Registered: Feb 2004
Distribution: Mandrake 9.2
Posts: 14

Rep: Reputation: 0
need a command line utility that will upload a file to a host


background / issue:
I am working on a content management system, and it's almost ready to go, but the publish wont work

digging around, I've found out that they are using a command line file per file upload with sftp to the host machine, and apparently the command is this:

Code:
/usr/bin/sftp -b /var/www/html/tmp/uplPRCybF admin@192.168.0.5 -pw password
I tried on both of my linux machines (centOS 4 and 5) and neither of them like that...it just spits out the little help for sftp

I figured it might be an older version of sftp, read the man files hoping I can find something, nothing that is useful with me

tried re-arranging the command structure, nothing

the farthest I got is this:

Code:
sftp -oPort=21 -b fonts.html admin:password@192.168.0.5
and it just hangs there...

I am confused, I need a simple ftp upload tool that respects a structure like this, if possible

Code:
ftp -port -file_local_path -file_target_path user:password@ip
I can't find anything, it's late, and I've been banging my head against the table all night trying to figure this out

if anyone has any suggestions or can point me in the right direction, I'd really appreciate it

thanks guys and gals
 
Old 10-01-2007, 03:34 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Let's see... the -b <batchfile> option to sftp means "execute commands written in batchfile upon connection", so probably is not what you are looking for. E.g. if you have a file like this
Code:
cd /some/dir
get somefile
get anotherfile
put myfile
quit
these ftp commands will be executed on the remote host, as soon as you establish a connection like this
Code:
sftp -b batchfile user@host
if you want to copy just one or more file to a remote machine, better to use the scp command, like this
Code:
scp filetocopy user@host:/some/dir
this will copy the file in /some/dir on the remote host. If you omit the path, files will be copied in the user's home. Please, note that the colon ":" after host address is mandatory, otherwise files will be copied locally as a normal cp command.
Just a couple of notes: ssh/sftp/scp commands will travel through port 22 by default, not port 21 (reserved to the "normal" ftp protocol). Second, it is not possible to write password in clear text on the command line, due to the nature of these commands themselves (all the traffic is encrypted). You may consider to use public/private key authentication as a mechanism to avoid be prompted for password. Useful manpages (other than sftp) will be
Code:
man ssh
man ssh-keygen
man scp
 
Old 10-01-2007, 03:50 AM   #3
AAnarchYY
Member
 
Registered: Sep 2004
Location: Carlisle, MA
Distribution: Debian 8
Posts: 419

Rep: Reputation: 30
the problem with your command is the -pw password part, as far as i know i dont think its possible to specify a password on the command line like that.

the most you can do with sftp is set up trusted keys between the servers for passwordless auth,
 
Old 10-01-2007, 12:15 PM   #4
Leb_CRX
LQ Newbie
 
Registered: Feb 2004
Distribution: Mandrake 9.2
Posts: 14

Original Poster
Rep: Reputation: 0
thanks! much appreciated, I didnt know you could setup trusted keys

from the looks of it, this is me adding a certain level of complexity that I don't need for this somewhat basic class...I talked to the person who owns the CMS, and apparently an older version just used straight PHP ftp commands, or something along those lines, and this sftp was custom to 1 client who didn't want potential 2 way communication between the live server and the app...go figure

I'll be switching back to that class, and hopefully all will go well

thanks again
 
Old 10-01-2007, 12:35 PM   #5
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
scp is ideal for this sort of thing. Again, if you want to have it run non-interactively, you should set up public key authentication.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
command Line SSH download-upload mirat46 Linux - Newbie 1 05-11-2006 04:12 PM
Best way to upload (FTP) something via the command line... obelxi Linux - Networking 2 03-17-2005 06:15 PM
command line setup utility sikkalgopal Mandriva 3 09-14-2004 12:41 PM
Where is Command line utility for Cups and command tutorial mossy Linux - Software 8 01-16-2004 12:24 AM
Command line utility costasm Linux - Software 1 10-24-2003 09:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:20 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