How to transfer a file from unix server to windows pc - windows

Right now I am using winscp to manually copy files from unix server to my windows desktop.
I Would like to automate the same by running some script in unix.
Can someone please help?
-Sajith

The simple answer is: run an FTP server on Windows and write a simple FTP client script on Unix.
For Windows, you can use
IIS (built in to all versions of Windows, but switched off by default)
Filezilla -- free https://filezilla-project.org/download.php?type=server
one of the many proprietary FTP server programs. See http://en.wikipedia.org/wiki/List_of_FTP_server_software
At the Unix end, write a script to control the built in FTP client.
Another answer is: use IIS on Windows as a file uploader/downloader by writing a really simple Web site. Use wget or curl at the Unix end.
Another answer is: implement SAMBA on Unix, so that it joins your local Windows network. Copy files using standard shell commands.
Another answer is: use Dropbox and transfer files via the cloud.
I could probably think of more, but that's enough.

Related

how to copy files from solaris to windows

Guys this is my first solaris script. I am really sorry if the question is obvious.
Thanks for your answers. We have a Solaris server in which I want to backup the database and then I want to copy the back up to windows back up server.I am planning to write a Solaris bash script and schedule it to run weekly.At first I was thinking of developing a windows batch file but there are several Linux/Solaris commands that I want to be executed and batch file didn't work well, that's why I decided to do it as a Solaris bash script. On Solaris side I created a script for creating the back up, now my problem is to write a script in which I can copy the back up from Solaris to windows back up server over the network.
Thanks
It is not clear from your question if you need to write a script that can do the transfer of files in an automated way ... or if this is an ad-hoc requirement. Anyway I'll go with the latter just like the other answers you've got so far.
For anything related to working with Linux/Unix hosts from a Windows box you'll enjoy MobaXterm. It's an all-in-one handy tool that wraps all the other tools that you would otherwise have to install (terminal emulator, scp, ftp, X server, etc). I can only recommend it. There's a free version. (no, I'm not affiliated with MobaXterm in any way).
Here's a picture where I've logged into a Solaris box.
The right-hand side is essentially an embedded Putty. The left hand-side allows you to upload/download files to/from your remote host, in this case a Solaris host. You would press the buttons I've circled.
MobaXterm has tons of other features packed in a footprint of only 15 Mb.
Easiest option:
Start Command Prompt on Windows box, type;
ftp <solaris-ip>
username password
bi
get <file>
quit
Second easiest option:
Install FileZilla FTP server on Windows
Sit at Solaris box & start xterm
ftp <windows-ip>
username password
bi
put <filename>
quit

monitor a directory and pull new files as they appear - bash script

I need to pull log files from a Windows server. The log files appear every minute and I am trying to ftp to the server pull the file back to the linux box and process it. I have been looking around and found about inotify, I am not sure how to use it in a bash script after ftp to the Windows server. I am open to other implementation it does not have to be ftp/inotify but I am not sure how this could be done.
any ideas??
Two products come to mind depending on how you plan to approach the solution.
I personally use Splunk on a variety of platforms (Windows & Linux servers/local Linux & OSX dev environments). It is a real-time log aggregator that features an API and the ability to query. Even if this doesn't solve your problem, the free version has some very robust features that you should consider: http://www.splunk.com
The second approach would be synchronization of your web directories using something like RSync. I've used RSync on Linux boxes and always appreciated what it can do. I even see it now has a Windows port: https://www.itefix.no/i2/cwrsync

Is it possible for a Perl script running on a Unix/Linux platform to create Windows Shortcuts?

If I want to create a *nix symlink, I'll call symlink();, if i'm running a script on windows and I want to create a shortcut, I'd use Win32::Shortcut.
But what if I want to create a Windows shortcut if running a script from a *nix machine?
I'm accessing a SMB share on a Windows Server 2003 machine from my *nix machine.
Well, I don't know if Samba provides an API for that. On the other hand, Windows shortcuts are just .lnk files in a specific format.
It's been a long time since the initial question, but I've had the same issue and found a solution.
I wrote an application whose goal is to allow anyone to create lnk files from any OS.
I started writting it in bash and then I converted it in C (the sources are available).
It's still fresh, so except me nobody tested yet, but you can have a look here :
http://www.mamachine.org/mslink/index.en.html

What tools do you use to upload files to amazon ec2 Linux instances?

I am using the standard fedora AMI with the LAMP stack bundled and I want to upload files onto the server from my Windows desktop.
What is the "normal" approach for this? I am not a UNIX admin by any stretch, although I am more than comfortable with FTP and the basics of a BASH shell.
As far as I can see there is no FTP server installed by default on the remote virtual machine, and I am unable to open one up at my end because of firewall restrictions. I looked at WinSCP, but before I go to the lengths of installing and configuring that I wondered what the expected means of doing this might be. In any case I don't see how WinSCP or any other FTP based tool can work without the target machine listening, which implies something like and FTP server.
Is there anything like a Windows remote desktop connection?
I could mount an S3 elastic storage volume from within EC2, but it is a bit of a sledgehammer to crack my little nut of just wanting 100k of files copied up to the server.
This is a different question to getting my web application running on the virtual server to save files locally, which is what the other SO questions in a similar vein seem to be asking.
Any ideas welcome.
I use putty's psftp, which uses ssh. If you can ssh into the box, then psftp should work.
http://www.chiark.greenend.org.uk/~sgtatham/putty/
You will first need to convert your pem private key to a ppk using puttygen for psftp to use the keyfile for authentication because it only uses ppk format and not pem format, as far as I know.
You've made the right choice with WinSCP. SCP is based on SSH, not FTP, and SSH and SCP are standard on Linux servers. So, WinSCP takes a bit of configuration bit its the simplest. Your alternative would be to install and maintain and FTP server - a lot more work there! There are equivalents to Remote Desktop but they're way more complicated to setup.
If you're having trouble with configuring your SCP program with your key but you have the ability to "shell" in, you could create a new linux user on the server with a password, then you can use that password instead of the key in WinSCP which is easier.
"In any case I don't see how WinSCP or any other FTP based tool..."
SCP (and SFTP, for that matter) is an entirely different protocol from FTP. Data is transferred over an SSH channel. If you have SSH access to your virtual machine, SCP/SFTP should work.
If you prefer a graphical tool, have a look at the S3Fox Firefox plugin (my choice), or peruse this list of standalone graphical S3 browsers.
For S3 I use Cyberduck (on Mac) and S3Fox. For mass uploads (in scripts) I use s3sync. I manage EC2 Instances with ElasticFox and original ec2 Tools from Amazon.

Modifying files on remote Ubuntu server from Windows PC

I am developing some Python programs that I'm running on a remote Ubuntu Linux server (hosted on Slicehost). I would like to work on the source in an IDE on my Windows Vista PC, and have all file modifications sent directly to the Linux box without my intervention (i.e. without having to manually SFTP the files each time I change them). What is the very easiest way I can do this?
WinSCP includes a basic remote file editor, though if you want to use a proper IDE for your development this won't be much help.
I'd suggest you run a version control system like subversion, which would allow you to write a post-commit hook to automatically rsync your code the server with each commit.
Use PuTTy and SFTPDrive.
PuTTy is an SSH client, and SFTPDrive ($39 USD) will allow you to mount your remote file system locally as a drive letter.
Install Samba and OpenVPN on the server, and OpenVPN on the client. Setup Samba to share the directory tree you're interested in, and access it over the VPN for security. Perhaps Vista has non-sucky WebDAV support by now, and you could use WebDAV over HTTPS, but it was always crap under XP.
Ben's suggestion of a local dev environment using a VM is also a winner.
You could install cygwin and then have rsync run on cron every minute.
Or you could use Netdrive to access the server via FTP like a local disk:
http://tech.xptechsupport.com/netdrive-turn-your-ftp-into-a-drive-letter.html
Or you may be able to achieve something similar using cygwin and FUSE - you can on linux, but never tried it on cygwin.
Also, would it not be easier to set up a full dev environment locally? Maybe using a virtual machine? It'll be much quicker for testing. And then you can set up a shell script to transfer the current version to the slicehost server.

Resources