Moving files between Unix and Windows systems

There are many ways to movement files between Unix and Windows. In my listen, they autumn into three categories -- secure copy (let'due south not even remember well-nigh ftp), shared drives, and file synchronization. Each has its own advantages.

Secure Re-create

For secure copy, we have scp and sftp commands. Native to Unix systems, both commands are available for Windows as well. I use pscp (PuTTY's scp) which you should find in your PuTTY folder (e.g., C:\Programme Files\PuTTY or C:\Programme Files (x86)\PuTTY) if you have PuTTY installed. I make certain the folder is in my Windows search path so that I can admission it from any directory and then run commands that piece of work but like scp on Unix:

C:\User\shs> pscp myfile.txt shs@unixserver:/home/shs              

Works similar a charm. The command volition inquire for your password and motion the file or files specified. Wild cards are acceptable. Merely think that text files moved from Windows to Unix systems will retain their carriage returns and those coming in the reverse direction volition lack them.

Samba

Another option for moving files between Unix and Windows systems it to make a drive or folder available by "sharing" information technology. Both Unix and Windows have commands for this. To share files between the two types of systems, y'all can use Samba. Samba is an implementation of the SMB/CIFS networking protocols. So it runs on a Unix system and allows Unix directories to be accessed by Windows systems or Windows shares to be mounted on Unix systems.

To set upward shared directory on a Linux system, you have to add together a department to your samba configuration file describing what you lot're sharing and how. You will accept unlike settings depending on what y'all are sharing and its sensitvity. In general, home directories should be bachelor to their owners and public directories available to everyone. Withal, this doesn't hateful that you shouldn't limit who can access annihilation on the server. "Everyone" might mean everyone on a item subnet or in a particular group. Other settings in the smb.conf file allow yous to limit who tin can access Samba shares to specific hosts or IP ranges.

Shares gear up in the Samba configuration file (smb.conf) volition expect similar what you see below. Virtually section labels (eastward.g., "public") serve every bit the mapping name. The /shares/public binder shown below, for instance, tin can exist mapped on a Windows system with the command "net employ P: \unixhost\public" where P: is an available drive label, unixhost is the name of the Unix server, and public is the characterization we set in the smb.conf file. The label "homes", however, is a special 1 in that it tells the Samba service to allow domicile directories to be shared. Each user can and then map his or her own abode directory on their Windows systems.

[homes]    comment = Home Directories    browseable = no    read only = no    create fashion = 0750  [public]    path = /shares/public    public = yes    writable = yes    create mask = 0777    browseable = yes              

Samba also allows you to mount Windows shares on your Unix server. Sometimes it's easier to mount a shared Windows drive, copy the files it needs, and then unmount the drive than it would be to make this happen from the Windows side.

To mount a Windows share, you would use a control like this:

mkdir /mnt/datafiles mount -t smbfs -o username=remuser,password=abc123NOT //windowshost/datafiles /mnt/datafiles              

In this command, /mnt/datafiles is a mount point we're setting up to move the files we need, remuser is the name of a user recognized by the Windows organisation, abc123NOT is his password (delight use better passwords!), and windowshost is the proper noun of the remote system.

From the Windows side, you tin view what is being mapped and what is beingness share with the "net use" and "net share" commands.

Rsync

Copying files with rsync has the distinct advantage of great performance since rsync smartly copies changes in files rather than complete files whenever that'due south an selection. This ways that, if a single byte has been added to the source file, a single byte will be transferred to the destination.

Rsync tin be used to copy files from i system to another, only it'south meant to go on files synchronized betwixt systems. You may be familiar with using rsync between Unix systems, but versions of rsync are bachelor to synchronize files between Windows and Unix systems too. Check out Grsync for Windows systems at sourceforge -- http://sourceforge.net/projects/grsync-win/?source=recommended&_test=goal.

Join the Network World communities on Facebook and LinkedIn to comment on topics that are superlative of listen.

Copyright © 2012 IDG Communications, Inc.