curl - Uploading the content of a variable as a file into FTP server using Bash -
Using Bash scripting, I am trying to upload the contents of the variable to an FTP server.
M0eSl8NR40wHI need to do the following:
- The time / date stamped file (i.e. PASSWORD_18_02_2014) in the FTP server
- The file requires the same content of $ HASHED value (i.e. PASSWORD_18_02_2014 requires M0eSl8NR40wH inside it).
I am trying to curl, I could not work by using the following:
UPLOAD = "curl-T $ hashhed ftp: / /192.168.0.1/passwords/ - username: password "$ UPLOAD
Your help is much more appreciated.
Something like this can help you (tested on linux minus 13):
#! / Bin / bash FILENAME = ENG_DET_DATE +% d_% m_% Y * echo $ HASHED & gt; $ FILENAME FTP-N your_ftp_site & lt; & Lt; EOF user your_user_name_on_the_ftp_server put $ FILENAME EOF rm $ FILENAME
Some cache:
- You have to export, eg when you set it, Set as:
export hashhed = M0eSl8NR40wH
- The above is assumed that you will run it from the terminal and you can type your password when prompted < Li> You can add some "CD" commands before the line starting "FTP" on the basis of that file, on which you can upload the file to your FTP Do not forget to make the script executable
chmod u + x your_command_script_name
You can code the password after the user name that starts the line "user", but it leaves a big danger that someone can search for their password on FTP passwords, at the very least, only the bass command script Make you readable:
chmod 700 your_command_script_name
Comments
Post a Comment