FTP server mysterious behavior - can anyone explain why this happens? - sftp

We have an SFTP i.e secure FTP server which is perfectly like and able to login.
Using filezilla i tried to create the following file directly.
Employee_Details_Export_2014-11-03 03:12:11.csv
the FileZilla doesn't create a file and prompt an error message saying -
Filename may not contain any of the following characters:/:*?" <>|
Whereas, the following works fine..
Create a test file
Renamed it as Employee_Details_Export_2014-11-03 03:12:11.csv
Not sure what is happening and what is the issue here?
Please let me know in detail.
Thanks in advance.

As has been suggested, don't use colons. From messing around, however, I'm guessing that you've found an unavoidable bug in Filezilla. The restricted character list are the characters restricted on Windows.
There is not mkfile command, so when you create a new file named "ABC.txt" you'll get something along the lines of:
Command: put "[PATH]\empty_file_yq744zm" "ABC.txt"
Status: local:[PATH]\empty_file_yq744zm => remote:[PATH]/ABC.txt
So what happens is Filezilla creates a file on your local machine, and then uploads it. However, Windows won't let it create a file with a colon, so it fails. However, there is a rename command, and that has nothing to do with the Windows environment. You can also create a directory with a colon without any issues since there is a mkdir command.

Remove the colons in the filename and it should work. You're using invalid characters in your file naming convention.
Employee_Details_Export_2014-11-03_03_12_11.csv

I think this is not related to stackoverflow, but...
this is a conditional on filezilla, not on your server, they added that to the create file
If you would like to fix this you could edit and recompile filezilla,
this is on filezilla code on the file file_utils.cpp

Related

ASP.Net web application cannot read a file within folder

In my asp.net web application, I read the xml file for obtaining a key. If file is not present I show a form to enter the key details and then create the file.
First problem: My app does not recognize the file even if its there.
Second problem: I am running application on the server. When writing, rather overwriting the file, browser shows the username, password prompt before writing the file. If I enter admin credentials it allows to create a file.
I have checked all possible combinations of permissions on the file / folders, but could not resolve the problem.
Any ideas, what I could be missing here?
You read the xml file but is it as a part of your solution? If yes, are you reading it through relative path i.e. are you using Server.MapPath to read it like Server.MapPath("~/Files.test.xml")? Once you use relative path, I don't think it will ask you credentials as it still is in your project directory.
It should work. I am also reading and writing files in my web application.
If it still does not work, please tell me the way you are reading file.
Thanks,

I add a line of text to my CSS file, garbage comes through the browser

I'm using Vagrant to manage a VirtualBox instance of Debian Wheezy with PHP 5.5 and nginx 1.4.4. My local environment is Mac OS X 10.9 with PHP 5.5 and Apache 2.2.24. I have a synced directory that points to my document root for this particular project.
My local machine has a VirtualHost setup that also points to the document root for this project. Therefore, I actually have two different URLs that I can point my browser to, and the same code will be executed. One URL hits the virtual machine, while the other URL hits my local Apache installation.
I've been able to edit several PHP files with no problems. I make the changes locally and they immediately show up on both the virtual machine and my local web server. However, whenever I try to edit CSS, things get bizarre. I'm trying to add a single line of CSS to a static CSS file. Something along the lines of:
.body {margin-top:50px}
When I make this change, the virtual machine goes nuts. I'm not sure if it's sending a corrupted file, or if it's just appending a bunch of weird characters at the end of the CSS file, but I can't even paste them here. I did a Charles dump of the request for the CSS file and the response looks like this:
I've looked at the file in vim through the virtual machine. I've looked at the file using multiple text editors. For the life of me I can't find anything wrong with it. When I load the exact same file through my local Apache installation, it works just fine:
Notice that the body declaration appears between button and footer, and there are no weird characters at the end of the document.
The other thing that I noticed is that my the whitespace is being manipulated at some point as well. The CSS file in question uses four spaces for indentation, but in the response from the virtual machine, the lines only have two spaces of indentation. You can't see it from the pictures because they're formatted by Charles, but I looked at the raw data. It's truly bizarre.
Do you have any idea what is causing the manipulation of my CSS file when it is being served via the Vagrant/nginx combo vs my local/Apache combo?
EDIT
I pasted some of the characters into a hexadecimal converter and it converted all the characters to question marks. I tried a binary to decimal conversion and they all turned into �, which from what I can find is "used to replace a character whose value is unknown or unrepresentable in unicode". I ran file --mime on the file and it returned rental-application.js: text/plain; charset=us-ascii. So...nginx settings maybe?
I'm having the exact same issue with JavaScript files. If I vagrant destroy and vagrant up is the only way I've found to resolve the issue so far. It doesn't make for quick troubleshooting when I have to reboot my VM between file saves.
Every method that I use to look at the file works. The only issue is when it is served through nginx, which makes me think I have some type of encoding setting wrong. It's a mostly stock setup.
More bizarre
If I mv rental-application.js rental-application.html and load the page in my browser, it comes across perfectly. The same applies if I change the name to rental-application.php. However, as soon as I change the name to rental-application.js or rental-application.css, my changes disappear and the � characters re-appear at the end of the document.
Even MORE bizarre
I can create a js file on the VM and it will load fine via the VM nginx server. If I subsequently modify the file I just created and reload it, the changes don't appear, just the garbage characters.
If I mv that file to a different name that ends in .js, the garbage character problem still persists. However, if I then cat the contents of the renamed file to a new file with the original name, all is well in the universe.
Just so if people end up here for the same issue, they have the solution on how to resolve this: you need to turn off sendfile() in your web server' settings.
For Apache: EnableSendfile off
For Nginx: sendfile off
Quick explanation: https://coderwall.com/p/ztskha
You can find more online if you need more details.
Now you can get a beer and enjoy your static file being transferred properly, not more corrupted files :)

DirCopy() Not Working

I'm working in AutoIT to script a basic task I'll have to repeat on 50ish workstations.
I need to copy a directory and it's subdirectories and files (recursively) to a network share as a backup. For some reason, DirCopy() does not work at all.
I've tried running it on several different directories (thinking permissions issue, I'm Domain Admin account), tried doing a RunAs (again thinking permissions), and also put the #RequireAdmin tag to force the program to run on an elevated account. Nothing has worked. I can't even get it to copy empty directories.
DirCopy(#DesktopDir & "\SAMPLE\TEST1", #DesktopDir & "\SAMPLE\TEST2", 0)
Please advise!
Just figured this one out.
Turns out DirCopy() is a pretty stupid function that cannot handle if the destination directory already exists (it wants to create it for you). So if you kill the destination directory, then run the above code line, all woks as expected. But then if you add a new file into the source directory (TEST1 in my example), then it breaks again and does nothing.
Go figure...
Now time to find a work-around using something like xcopy...

Red filename in Ubuntu CLI (Vagrant)

I am building a FuelPHP application running on an Ubuntu VM powered by Vagrant.
I am trying to include a CSS file on the global wrapper for all my pages, but Firebug tells me it isn't there. (the file path is correct in my <_link rel...>).
The CSS file is actually a compiled from a bunch of LESS files using an app called LiveReload for Mac.
The Apache server on my VM is set to serve from a mounted folder on my Mac, anyone who has used Vagrant should know what I mean by that.
Anyway, LiveReload dumps the CSS file in the correct place, and is populated on my Mac:
However, SSHing into the VM and examining the CSS file leads me to believe that something weird is happening. Firstly, the filename is in red (but it exists!):
Secondly, opening it with a text editor (nano in this case) shows it to be blank, despite it being full on the Mac:
So my question is... wtf is going on here? Why is it showing empty on the VM? Why is it red? Why can't Apache find and serve it?
EDIT, still struggling with this.
I added my own 'test.css' file and it loads that fine. Just not the app.css generated by LiveReload. There's something wrong on the VM. Can anyone help? It's one of those annoying things thats holding up my development.
Here's the stack trace (although i'm sure it has nothing useful in it):
If I guess right than you have a wrong mod rewrite rule which redirects your request to a php script which tries to include a file which does not exists.
So check your .htaccess file
Argh, renamed the file to appcss.css instead of app.css and it works. Changed it back, it doesn't. System musn't like that name for some reason. Annoying the amount of time i wasted, but fixed now!

How to upload a file to a server via FTP using R?

How to upload a file to a server via FTP using R?
This should work:
library(RCurl)
ftpUpload("Localfile.html", "ftp://User:Password#FTPServer/Destination.html")
Where Localfile.html is the file to be uploaded, User indicates the user name and Password the password to log into the server while FTPServer is a placeholder for the server name and possible path to use while last but not least Destination.html is an example of the name the to be uploaded file gets on the server.
Your best bet may be the RCurl package. From the DESCRIPTION:
[...]
Additionally, the
underlying implementation is robust
and extensive, supporting
FTP/FTPS/TFTP (uploads and downloads),
Otherwise, rethink your problem. Maybe HTTP POST will do as well. It's not 1986 anymore so you're not required to use ftp.
If you can access it from the command line, then you can do:
system("ftp ...") # where ... is the argument list
You could easily wrap this in an R function if you plan on doing it often.
This probably isn't the answer you're looking for, but I solve my sharing problems by moving the file to my Public dropbox folder and link to that in my R code.
My two pennies.

Resources