This option will reset the home page of this site. Restoring any closed widgets or categories.

Reset

Simple shell script to FTP file from your Desktop to FTP server


#!/bin/sh
HOST='ftp.mistonline.in'
USER=''
PASSWD=''
FILE='file.txt'
ftp -n $HOST << END
quote USER $USER
quote PASS $PASSWDcd databackup/DB/
put $FILE
quit
END
exit 0


The Tricks

Getting the password to the ftp server without having the ftp client program read the password from /dev/tty requires two tricks:

  1. Using the -n option on the ftp client program to prevent the ftp client from trying to log in immediately. That way, the ftp client does not ask for a user ID and password. No use of /dev/tty.
  2. Use the ftp client program command quote to send user ID and password to the ftp server.
  3. The file /dev/tty is a character file with major number 5 and minor number 0, usually of mode 0666 and owner.group root.tty.
  4. /dev/tty helps output displayed to the  (terminal)
VN:F [1.5.7_846]
Rating: 0.0/10 (0 votes cast)
VN:F [1.5.7_846]
Rating: 0 (from 0 votes)

Related posts:

  1. Simple Pagination Using PHP Script
  2. Simple PHP Login Script
  3. Simple file upload script using php
  4. Loading swf file from another server using crossdomain.xml
  5. Find Absolute Path Of A File Or Directory Using PHP
  6. Simple PHP mail Script
  7. Creating a simple class file using PHP

Leave a Reply

Comments (required)

Spam Protected