- Table of Contents
- Copyright
- About the Lead Authors
- About the Contributing Authors
- Acknowledgments
- Tell Us What You Think!
- Introduction
- I. Red Hat Linux Installation and User Services
- Chapter 1. Introduction to Red Hat Linux
- Chapter 2. Installation of Your Red Hat System
- Chapter 3. LILO and Other Boot Managers
- Chapter 4. Configuring the X Window System, Version 11
- Chapter 5. Window Managers
- Chapter 6. Connecting to the Internet
- Chapter 7. IRC, ICQ, and Chat Clients
- Chapter 8. Using Multimedia and Graphics Clients
- II. Configuring Services
- Chapter 9. System Startup and Shutdown
- Chapter 10. SMTP and Protocols
- Chapter 11. FTP
- Chapter 12. Apache Server
- Chapter 13. Internet News
- Chapter 14. Domain Name Service and Dynamic Host Configuration Protocol
- Chapter 15. NIS: Network Information Service
- Chapter 16. NFS: Network Filesystem
- Chapter 17. Samba
- Installing Samba
- Getting a Simple Samba Setup Running
- Configuring Samba
- Configuring a Samba File Server with linuxconf
- Sharing Files and Print Services
- Optimizing Samba Performance
- Testing Your Configuration
- Running the Samba Server
- Accessing Shares
- Common smb.conf Options
- Samba Resources
- Using Samba as a Logon Server
- Samba Troubleshooting Tips
- Samba Security
- Using SWAT for Web-Based Samba Configuration
- Using Samba as a Linux Migration Tool
- Summary
- III. System Administration and Management
- Chapter 18. Linux Filesystems, Disks, and Other Devices
- Chapter 19. Printing with Linux
- Chapter 20. TCP/IP Network Management
- Chapter 21. Linux System Administration
- Chapter 22. Backup and Restore
- Chapter 23. System Security
- IV. Red Hat Development and Productivity
- Chapter 24. Linux C/C++ Programming Tools
- Chapter 25. Shell Scripting
- Chapter 26. Automating Tasks
- Chapter 27. Configuring and Building Kernels
- Chapter 28. Emulators, Tools, and Window Clients
- V. Appendixes
- A. The Linux Documentation Project
- B. Top Linux Commands and Utilities
- C. The GNU General Public License
- D. Red Hat Linux RPM Package Listings
Using Samba as a Linux Migration Tool
Some computer users want to migrate completely to Linux, leaving Windows behind. For such users, Samba is an indispensable migration tool. This discussion assumes the user has separate Windows and Linux boxes, network connected, and the Linux box is running Samba.
The first step is to decide the structure of your data tree on the Linux box. For backup and tracking purposes, many consider it best to have all real data in the data tree, leaving the home directory for temporary work. An excellent plan is to put all data under a directory called /d, and place all data accessed exclusively with Windows-based programs in subdirectory /d/w.
The next step, and it's absolutely vital to do this before transferring any files, is to have a working backup system for the /d tree. See Chapter 22, "Backup and Restore."
Creating the Data Directory Share
Now the first step of the transition is simply moving data files to directories under the /d/w directory, and accessing them via Samba with the same Windows programs as always. The Samba share for /d looks like this, assuming it's to be used only by user myuid:
[d] comment=Linux Data Directory path=/d writeable=yes valid users=myuid
Naturally, in the preceding example the /d directory should be owned by myuid, and the file mode of /d should be 0700. Slightly more complex is the situation in which several people need to access and modify the files. In such a case, add all such people in a group (let's call it hometeam). Make /d owned by root with group hometeam and make the file mode for /d 770. Now anyone from group hometeam has total access to the directory. Next, create the [d] share as follows:
[d] comment=Linux Data Directory path=/d writeable=yes valid users=@hometeam force group=hometeam create mode=660 directory mode=770 oplocks=no
In the preceding share definition, anyone in group hometeam, but nobody else, can access the share through Samba. The force group=hometeam statement sets the group to hometeam for files newly created through Samba. Otherwise, each file's group would be set to the primary group of the user that created the file. Thus, the force group= hometeam line enables different users to edit each other's files.
The create mode=660 sets the mode on files created through Samba to 660 so anyone in the file's group (which of course was set to hometeam by the force group=) can read and write the file. The directory mode=770 is done for similar reasons.
Finally, the oplocks=no prevents on-client caching. This is desirable if and only if files are expected to be edited on both the server and the client, because doing so with on-client caching would create corruption. In a Windows-to-Linux transition, it's very likely that files will be edited on both sides.
The Early Transition
The earliest part of the transition is simply moving data from the Windows hard disk to the /d/w directory, and accessing it using the same programs as always. This data migration needn't be done in a single step, as long as there's an organized method to keep track of what has and hasn't been moved. It might be tempting to leave copies of the original files in the original Windows directory, but this practice would lead to a version control nightmare. Instead, keep Windows copies under something like a c:\moved directory. Once you're confident that the files on the Linux side are correct and are being regularly backed up, you can delete their Windows hard disk counterparts with confidence.
The next step is to edit the data with Linux programs. For instance, you might use Gimp instead of Paint Shop Pro to edit .jpg files. Once you start editing some of a directory's files using Linux-based software, it's best to move it to an appropriate directory under /d, rather than /d/w.
Eliminating Those Pesky DOS Carriage Returns from Text Files
In text files, DOS and Windows delineate lines with a carriage return line feed combination (CRLF). Linux (and all UNIX and UNIX workalikes) use only a line feed (LF). Before working on a text file on the Linux box, you should convert it to the Linux line feed–only format. The following is a simple script to convert DOS format files to UNIX format:
#!/bin/sh
while [ $1 ]; do {
echo Converting $1
cp $1 $1.dos
touch -r $1 $1.dos
cat $1.dos | sed s/^M$//g > $1
touch -r $1.dos $1
shift
}
done
The preceding script works on single files and on wildcards. It converts each file from DOS to UNIX file format, keeping a backup (which gets overwritten the next time the script runs) as a .dos file, and retains the original file date and time due to the touch commands.
The Migration Endgame
Once you've begun using Linux programs to edit your data, you might notice that it's inconvenient to continually move from one computer to the other. VNC to the rescue. VNC is a GUI-aware remote access program similar to PC-Anywhere, except that it works on Windows, Linux, UNIX, and most UNIX workalikes.
By running VNC server (WinVNC.exe) on your Windows box and vncviewer on your Linux box, you can operate your Windows box from your Linux box, and never need to switch chairs (unless you need to insert a CD, power down, and the like). The vncviewer program comes ready to run on your Linux box, and you can download the Windows VNC server from http://www.uk.research.att.com/vnc/index.html. Install the Windows VNC server per the downloaded instructions, and then to access the Windows box from your Linux box, simply execute the following command in a GUI terminal on the Linux box:
$ vncviewer 192.168.100.5:0
The preceding command assumes the Windows box is at 192.168.100.5. You're asked to enter the same password you configured on the VNC server on the Windows box, after which your Linux box appears to "turn into" a Windows box. Be sure to use the F8 key to view the popup menu, from which you can toggle full screen mode, send an F8 character to the Windows app, send a Ctrl+Alt+Delete to the Windows machine, and other handy tricks.
There's more information on setting up VNC in Chapter 28, "Emulators, Tools, and Window Clients," and at http://www.troubleshooters.com/tpromag/200006/200006.htm#_vnc, and detailed VNC information at http://www.uk.research.att.com/vnc/index.html.
Summary | Next Section

Account Sign In
View your cart