webdevRefinery Forum: FTP with shell script - webdevRefinery Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Rate Topic: -----

User is offline Sole_Wolf 

  • Group: Members
  • Posts: 307
  • Joined: 24-March 10
  • Expertise:HTML,PHP,Java,SQL

Posted 04 August 2012 - 12:02 AM (#1)

FTP with shell script


I am trying to upload a file to my webserver using a shell script but I am having a little bit of trouble.

This is what I have so far

ftp -dvin "http://website.com" <<EOF 
      quote USER "user@website.com"
      quote PASS "password"
      put test.txt
      quit 


I also tried this code without any success

ftp -n http://website.com << EOF > ~/log.txt 2>&1
user user@website.com password
put test.txt
bye


It isn't really working and this is the first time that I have attempted to upload something with FTP in a shell script.

What am I doing wrong?
--Sole_Wolf
0


User is offline Quinn 

  • More pew-pew, less QQ
  • Group: Members
  • Posts: 1307
  • Joined: 08-March 10
  • LocationPalmyra, PA, USA
  • Expertise:HTML,PHP,Javascript

Posted 04 August 2012 - 12:09 AM (#2)

Is there a reason that you're using FTP over something more secure like SCP?
<Imp> [F3ar 40]  [PWNbear 17]  [magik 15]  [dissident 10]  [mark 7]

View PostKyek, on 07 February 2011 - 07:11 AM, said:

Though anyone who thinks Europe is a country should be smacked in the face. By a train.
0


User is offline Sole_Wolf 

  • Group: Members
  • Posts: 307
  • Joined: 24-March 10
  • Expertise:HTML,PHP,Java,SQL

Posted 04 August 2012 - 12:22 AM (#3)

View PostQuinn, on 04 August 2012 - 12:09 AM, said:

Is there a reason that you're using FTP over something more secure like SCP?

Security isn't really an issue for this script, I just want to upload a pre-determined file using a shell script. If scp can upload files via a shell script as well, I wouldn't mind scp advice.
--Sole_Wolf
0


User is offline Quinn 

  • More pew-pew, less QQ
  • Group: Members
  • Posts: 1307
  • Joined: 08-March 10
  • LocationPalmyra, PA, USA
  • Expertise:HTML,PHP,Javascript

Posted 04 August 2012 - 12:50 AM (#4)

View PostSole_Wolf, on 04 August 2012 - 12:22 AM, said:

Security isn't really an issue for this script, I just want to upload a pre-determined file using a shell script. If scp can upload files via a shell script as well, I wouldn't mind scp advice.

The easiest way I can think of would be to have a key and just do something like this:
scp -i key.pem test.txt user@website.com


Edit: I just saw your other topic - what Daniel, Luke, and Tobias said is correct.
Edit #2: Fixed order of names.
<Imp> [F3ar 40]  [PWNbear 17]  [magik 15]  [dissident 10]  [mark 7]

View PostKyek, on 07 February 2011 - 07:11 AM, said:

Though anyone who thinks Europe is a country should be smacked in the face. By a train.
0


User is offline lobabob 

  • Group: Members
  • Posts: 98
  • Joined: 21-March 10
  • LocationWouldn't you like to know?
  • Expertise:HTML,CSS

Posted 04 August 2012 - 04:29 PM (#5)

I don't think he really cares about security for whatever he's doing. It seems like he just wants to figure out a way to ftp with a shell script.
"When the world goes mad, one must accept madness as sanity since sanity is, in the last analysis, nothing but the madness on which the whole world happens to agree." - George Bernard Shaw

Life = http://xkcd.com
1


User is offline Sole_Wolf 

  • Group: Members
  • Posts: 307
  • Joined: 24-March 10
  • Expertise:HTML,PHP,Java,SQL

Posted 04 August 2012 - 04:31 PM (#6)

Exactly lobabob :D. Anyways, I found out how to do it.

Thanks for the help.
--Sole_Wolf
0


User is offline dida 

  • Group: Members
  • Posts: 1982
  • Joined: 10-March 10
  • Expertise:HTML,CSS,PHP,Java,Javascript,Python,Ruby on Rails,Node.js,SQL,Graphics,Flash,MongoDB,CouchDB,Cassandra

Posted 04 August 2012 - 04:34 PM (#7)

View PostSole_Wolf, on 04 August 2012 - 04:31 PM, said:

Exactly lobabob :D. Anyways, I found out how to do it.

Thanks for the help.

Quote

I found out how to do it.

Quote

how


TELL US D:
0


User is offline Quinn 

  • More pew-pew, less QQ
  • Group: Members
  • Posts: 1307
  • Joined: 08-March 10
  • LocationPalmyra, PA, USA
  • Expertise:HTML,PHP,Javascript

Posted 04 August 2012 - 05:14 PM (#8)

If you've figured out an answer to your own problem, you should always tell others how you've figured it out for future purposes.
<Imp> [F3ar 40]  [PWNbear 17]  [magik 15]  [dissident 10]  [mark 7]

View PostKyek, on 07 February 2011 - 07:11 AM, said:

Though anyone who thinks Europe is a country should be smacked in the face. By a train.
0


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Enter your sign in name and password


Sign in options
  Or sign in with these services