File transfer in Linux : FTP in linux : Shell script to file trnsfer

This script use to transfer file from linux to ftp server. You can automate this file transfer by putting this file in cronjob also.

#!/bin/sh
HOST='ftp.users.qwest.net'
USER='yourid'
PASSWD='yourpw'
FILE='file.txt'

ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
put $FILE
quit
END_SCRIPT
exit 0

 Please note that :

  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.

Related Posts

  • 63
    FTP command not found # ftp 192.168.1.56 -bash: ftp: command not found # yum -y install ftp The above command will install the ftp client package on your CentOS server. If you use a proxy server for internet access,
    Tags: ftp, server, file, linux, transfer, password, client, user, script, quote
  • 51
    What is FTP? FTP is an acronym for File Transfer Protocol. As the name suggests,FTP is used to transfer files between computers on a network. It is a standard network protocol based on TCP. FTP is built on a client-server architecture and uses separate control and data connections between the client and the server. FTP (File…
    Tags: ftp, server, transfer, file
  • 39
    You need to create a shell scrip, needed to call from a crontab, to contact a FTP server and put or get a file. You will need to modify the variable section to reflect your settings. ---------------------------------------- #!/bin/bash HOST=ftp.server.com  #This is the FTP servers host or IP address. USER=ftpuser             #This is the FTP user that has access to the server. PASS=password          #This is the password for the FTP user. # Uses the ftp command with the -inv switches.  -i turns off interactive prompting. - Restrains FTP from attempting the auto-login feature. -v enables verbose and progress. ftp -inv $HOST 
    Tags: ftp, user, server, file, script, shell, linux
  • 36
    A Shell script for killing slow MySQL queries: #!/bin/sh # Credentials for a MySQL user with PROCESS, SUPER permissions USERNAME= PASSWORD= # MySQL Server location HOST= PORT=3306 TIMEOUT=60 # 1 minute TARGET_USER= # MySQL user to monitor MYSQL="mysql -u $USERNAME --password=$PASSWORD -h $HOST -P $PORT -B" $MYSQL -N -e 'SHOW…
    Tags: user, linux, shell, script, password, server
  • 31
    What is samba server? Samba is an Open Source/Free Software suite that provides file and print services to SMB/CIFS clients. Samba is freely available, unlike other SMB/CIFS implementations, and allows for interoperability between Linux/Unix servers and Windows-based clients. Samba uses the TCP/IP protocol that is installed on the host server.…
    Tags: server, file, linux

Satya Prakash

VOIP Expert: More than 8 years of experience in Asterisk Development and Call Center operation Management. Unique Combination of Skill Set as IT, Analytics and operation management.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: