Programming :: Unable To Use SFTP File Upload Bash Script

Oct 7, 2010

upload a file to a business partner of ours in another country. Currently they have an SFTP server set up for us that I am using to download a daily generated file from a previous requirement. I use a bash script to download it since its fairly simple.

Quote:

sftp username@address/filename_filedate.zip /home/user/filedirectory > /var/log/joblog

(removed private info) To satisfy the new requirement I have been trying to write something similar to this;

Quote:

sftp /home/user/filedirectory/filename_filedate.zip username@address:/remotedirectory/

sftps manual page only gives a hint about using a batchfile, however i still cannot get it to work. Does anyone know another way? Or if you can even suggest another method or application? It seems like a bit of a cop out you can EASILY download using the sftp command but can't upload.

EDIT - forgot to mention I have already got keyless entry set up using ssh keys.

View 1 Replies


ADVERTISEMENT

Fedora :: Files Corrupts - Upload A File (using Ftp Or Sftp) Some Weir Characters Are Included Inside The File

Mar 23, 2010

I just installed Fedora12 in a Core i3 machine... everything looks fine, but I have a huge problem... every time I upload a file (using ftp or sftp) some wier characters are included inside the file... for example.

[Code]......

View 6 Replies View Related

OpenSUSE Network :: Sftp Not Working For Upload?

Jan 24, 2010

I`ve the following internet configuration at home -

WORLD
to
ADSL modem in BRIDGE mode with DHCP

[code]....

All internet browsing function are ok, but when I try to upload file using sftp to a remote compute - it hangs. This is not a problem of remote computer. Download is working ok. I disabled firewall on wireless router but this did not help.

View 1 Replies View Related

Ubuntu :: Detect A Completed Sftp Upload?

Mar 22, 2010

I'm writing a file handler script that monitors (via a cron job) a directory that is an openssh sftp target for new files. When it detects a new file, it moves it, does an scp to another system, and sends an email. The problem I have is that I can't figure out a way to verify that the sftp upload is complete before I start manipulating the file.

View 1 Replies View Related

Ubuntu :: Sftp Force Permissions On Upload?

Mar 17, 2011

I'm running Ubuntu 10.04 LTS Using sftp, is there any way to force particular file permissions upon upload? I want the permissions on all files uploaded via sftp to be 664.

I've searched around and cannot find an answer. Many people ask similar questions and many responses recommend using umask, but as far as I understand it, umask is just a bit mask--it cannot be used to set permissions.

View 2 Replies View Related

Programming :: Upload A File With Cgi C?

Jul 12, 2011

i am trying to upload a file with cgi. I have an html code like below :

<table class=upload>
<form method='POST' enctype='multipart/form-data' action='upload.cgi'>
<input name=upfile type=file ><br>
<br> <input type=submit value=Press> to upload the file!</form>
</table><br>

I am trying to get the file with upload.cgi and execute a linux command in linux but i do not know how to. I use C code for that. Can you help me,please? How can i know the file from html in cgi C code?

View 2 Replies View Related

Programming :: Php File Upload Rename?

Apr 12, 2011

About php upload. I want a php upload script that renames and overwrite every uploaded file as onscreen.jpg I googled it but only found random number rename. Not working for me I want file name change and overwriting file on server.

View 8 Replies View Related

Programming :: Upload .cgi File To Webpage?

Apr 21, 2011

The software Nagios uses .cgi files to show a lot of things.. services, hosts, etc etc. Is there any way to pick up those .cgi files and import them to other web page? how to do it?

View 2 Replies View Related

Security :: Unable To Upload File Via Browser To The Server?

Feb 12, 2010

One of my user wants to be able to upload file via browser to the server. For that, i need to grant apache read and write access to a folder. How much secure is allowing apache to grant complete read and write access to a folder ?

View 2 Replies View Related

Red Hat / Fedora :: Curl FTPS Problem, Unable To Upload File?

Jan 6, 2010

I am using "curl" command line tool to upload file to ftp server through ftps.I have also tried with the "Secure FTP" software from windows using Implicit mode, which works fine while transfering files.Command as follows:

curl -vk --ftp-ssl -u [username]:[password] ftps://ftp.hostname/directory/test.txt -T /tmp/text.txt --ftp-pasv --disable-expsv
Login to server successfully but geting error while start to transfer data. The verbose

[code]....

View 9 Replies View Related

Programming :: CURL In Bash - Error "Upload Is Disabled During Short Maintenance Work (ETA 10 Minutes). Brb"

Mar 7, 2010

i'm trying to write a bash script to upload an image to [URL], but i can't get i working properly. Everytime i try, the html returns me a error saying "Upload is disabled during short maintenance work (ETA 10 minutes). Brb!", while from the browser everything works fine. This is my current command line:

Code: curl -L -b cookie-pix.txt -c newcookie.txt www.pixhost.org/cover-upload -A "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" -F 0=@/home/admin/Desktop/karm.jpg -F content_type=0 -F press=Upload And this is the html of the form:

[Code]....

View 1 Replies View Related

Software :: Fax .g3 File Unreadable / Unable To Upload The .g3 File As It Is An "invalid Attachment"?

Feb 6, 2011

I have been trying to get my message modem to read .g3 files under ubuntu (now 10.04) for over a year now, and have tried absolutely every application I can find to no avail.The output is always garbage.Every application tried gives the same result, but the fax is perfect on Windows, but I don't have a Windows machine any more.

I am unable to upload the .g3 file as it is an "invalid attachment" but have saved it to url.I have (hopefully) attached the resultant output from gimp, which is exactly the same with tkusr and efax. The fax is the weekly Debt collection agency touting for business (no, I don't owe them any money - yet)

I believe they all use a common file, something like g3topbm or g3topdf.If I try g2topbm on the command line: every second line has an error e.g: g3topbm: bad code word at row 202, col 5 (len 14 code 0x32), skipping to EOL

The .g3 files are created by a USR message modem which stores the files for later download ('cos the computer gets switched off at night.)

View 2 Replies View Related

Programming :: Shell Scripting: Trying To Combine Upload And Download Totals From Txt File By Ip Add

Sep 6, 2010

I have two files, uploads.txt and downloads.txt. I would like to combine the columns of these files based on the ip address. How can I best do this?

Uploads.txt Code: 192.168.0.147 1565369
192.168.0.13 1664855
192.168.0.6 1332868 Downloads.txt Code: 192.168.0.147 9838820

[code]...

View 7 Replies View Related

Programming :: Bash File Comparing - Report How Many Matching Words My Main File ?

Jun 9, 2009

I have been messing with diff and grep for 2 days now without result

I am trying to match a file consisting of words to many separate other wordfiles in a specific directory. one by one.

What i want the script to do is to report how many matching words my main file has with every file in the directory, each in turn

setup:

Each of em are plain text files with 1 word per line

Output should be something like:

SCRIPT REPORT:

View 8 Replies View Related

General :: Automating SFTP In Bash With Password?

Jul 13, 2010

I wrote a script ages ago to automate an FTP transfer. This was easy as within the script you can specify the password with password <whatever>. Now I am wanting to do a similar thing with SFTP (SSH). I know that SFTP works differently and I cannot specify the password within the script - what do I need to do on the server I am connecting to to either "trust" the host I am connecting from or to somehow specify the password for "sftp user@some_host"? It's IP address will always be the same.

View 4 Replies View Related

Programming :: Bash File Which Requests File Name

Nov 30, 2010

What's the easiest way for me to make a program that requests a file location and then tar balls it. I basically want to start making a simple method of using pv with tar (lzma).

View 8 Replies View Related

Programming :: Bash Awk Column To End Of File?

Sep 4, 2010

Code:

#!/bin/bash
ls -lhGg | while read line; do echo "$line"; done | awk ' { print $3" "$6 } '

what i want to do is be able to print column 3 and every column greater then 5. Has to be to the end of the line, since different filenames can have different amounts of words in them and the blank space is the separator. my current code works just fine if the file has no blank space.

View 8 Replies View Related

Programming :: Print File Name In BASH

Feb 26, 2009

I want to write a script that returns me name of the files that begin with the specified characters. like

Script out should be

View 3 Replies View Related

Programming :: Use Bash To Open A File?

Dec 12, 2010

How do I use bash to open a file, (file name as first parameter) cut n char from begin of each line, and write shortened lines to new file (outputfile name as the second parameter, n as the third parameter)

View 3 Replies View Related

Programming :: Bash File Names With Spaces?

Jul 24, 2010

I have a laptop that I am in through SSH. The laptop does not have an Xwindow system so I am using the program fbi to open an image on my laptop screen from my SSH connection:

fbi -T 8 picture.jpg #this opens the image on the laptops tty8 terminal

I've found that making a for loop does not work with files that contain a space in the name. Something to due with a bug that they call a "feature" that stops the first variable at the first whitespace.

Using a "while" loop is not exactly what i require either seeing as I want to be able to view each image in the directory on screen and tag it accordingly, before it jumps off to the next image, and I'm not sure how to add a pause to a while loop.

How do I make a Bash script and loop Variables handle files like "files that contain spaces.jpg"

View 5 Replies View Related

Programming :: Bash - Delete Only One Line From A File?

Apr 9, 2011

I would like to delete a single line from a file that contains many lines passing through the same values ​​as the two parameters. Again, I would like to delete a single line and not all those that contain parameters. How can I make bash?

View 14 Replies View Related

Programming :: Bash There Will Be Empty Lines At The End Of The File?

Mar 26, 2011

Using awk I pull the first field of a random line from my datafile.myvar1=`awk -F" " 'NR=='$randline' {printf "%s", $1}' myfileThis works fine. The problem is there will be empty lines at the end of the file. Rather than using awkto filter out blank lines I would like to figure this out first.So I test $myvar1 for a blank string after setting $randline to one that I know is blank:test -z "$myvar1" && echo "true" || echo "false"But, this returns "false"? So the string is not zero length. Why? It's a tab-separated file. Is awk storing the tab with the $1 field or something.This is where I get headache. I try to echo my variable to see what it looks like.

echo "$myvar1"
outputs: nothing
echo "My variable is [$myvar1]"
outputs: [y variable is [

Why is the closing bracket at the beginning? What character could be stored in $myvar1 that would do such a thing and how did it get there?

View 7 Replies View Related

Programming :: Bash To Monitor IP Addresses In A Txt File?

Oct 13, 2010

This code uses ping to check connectivity to a remote location and logs it to a .html file which is then stylized by css..

Code:

#! /bin/bash
path="$HOME/Desktop/IP_Monitor" #Path to write out files
ALT="0" #For styling alternative row

[code]....

I need to add a feature such that instead of hardcoding the ip address .. it takes them from a list and makes new files for each ip address for logging.. And also when log files are completed , They should be compressed using tar. How should i go about adding both these.. This is my first bash script.

View 6 Replies View Related

Programming :: BASH Read File Once Then Return To Top?

Aug 8, 2010

I have a script that reads part of a line, delimited between the first and second intended part by a colon. Then it "chops" the part after the colon, which are words offset by commas (counting them beforehand so as to catch every word in the string's second part), like this:

Code:

"COLORS.JPG:red,orange,yellow,green,"
(Returning)
red

[code]....

single script that parses/breaks both parts of a line like this "COLORS.JPG:red,orange,yellow,green;blue,indigo,violet," so that the two parts, separated into single words (or two and three words, sometimes with spaces) can be used as single-line annotations and written to JPEG files using Exiv2. So far, I haven't been able to come up with a script that does this without one part of the total string(usually that part after the colon) becoming the first word in the second array. In other words, I look for this:

KEYWORDS:

[ ]red
[ ]orange
[ ]yellow

[code]....

Or vice-versa (ie, the second array winds up as a single-line "member" of the first). I think it's because I'm using a single while read loop to read the text file in which the filenames and substrings happen to be. If there's some way of reading a file once and going back to the beginning to read it again in another while loop, I haven't found it.

View 14 Replies View Related

Programming :: Bash - Read File Without Whitespace?

Mar 14, 2011

I am struggling with Bash scripting at the moment (I can't seem how anyone can write scripts with this language!!!) I have a need at home to have a cron job execute daily to lookup my downloads.txt file, read each url (per line) and download content from that url. Then that entry needs to be removed (well I keep all urls in memory and clear the file afterwards). If an error occurred during the download process, then the url is written to a downloads.err file. I got all the above working except for properly reading the url from the text file without including newline characters. I am using the following to read:

while read url; do
--Do whatever here--
done < downloads.txt

How can I get it not to let the url variable have newline characters?

View 11 Replies View Related

Programming :: Bash Removing String From File?

Aug 7, 2010

I am trying to remove everything before my string code...

View 9 Replies View Related

Programming :: Bash Scripting: Menu From File?

May 29, 2011

I have a file called list.txt with on word on each line that changes in length. I'd like to make a menu, each line being its own choice. I pieced together most of it the only thing missing is a failsafe for typing a number out of range

Code:
#!/bin/bash
p=`cat list.txt | awk '{print$1}'`

[code]....

View 2 Replies View Related

Programming :: Reading From Text File In Bash?

Nov 8, 2010

I need to Read a path of a file witch is written in Text file i used this

Code:

FILENAME=$1
while read line
do
echo $line
done < $FILENAME

it worked and showed me the Line witch was written in my file but now my problem is how am gonna use that line as a path i mean for example if am gonna execute a linux command on that file like dpkg -i /path/to/the/file how am gonna export it from The $Line variable and use it after the command.

View 14 Replies View Related

Programming :: Passing Arguments To A Bash Source File?

Apr 24, 2010

Is it possible to pass arguments to a source file in a bash script? For example

#!/bin/sh
#
. /dir1/dir1/funclib -a -b

How would you check for the passed arguments in funclib without getting confused with any arguments passed to the main script?

View 5 Replies View Related

Programming :: Bash Script To Locate A Specific File?

Jun 14, 2010

I'm new to bash scripting and I've searched around the forums and Internet for this but haven't had any luck. I've found similar things but not what I need. What I need to do is write a simple script that uses what the user inputs to locate and display where a file is. I would prefer to use locate instead of find since I know that the person I am writing this for has locate on her machine (my mom, who is just beginning with Linux).I'm writing the script to make things easier for her while she learns In this particular part of the script I would like to be able to have the script prompt to enter the file she is searching for, read the her input and then display for her where the file is. I realize it would in most cases be much simpler just to teach her how to use locate, but she is very impatient and this is just a part of the script I will be writing, but I can't figure out how to do this.

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved