Quickly Setting Up PLIP and NFS

Need to transfer files between your desktop and your laptop? Here's the easy way to do it by networking.
If UIDs Don't Match

If you have two different UIDs on hermes and zeus, you can still read files on zeus from hermes in directory /nfs/hermes/hermname provided the files are world readable. Thus, you can list and copy files, but you won't be able to modify them, even if the directory was exported with read and write access. This is true because zeusname and hermname are considered to be two distinct users. Linux identifies users by using their UID, not their account names.

If all you want is to copy files from hermes to zeus and it does not bother you that files are world (or group) readable on hermes, you can leave things the way they are. More likely you will wish to write files on hermes' disk as well as read them. You must choose the same UID for zeusname on zeus and hermname on hermes, and it must be distinct from any other UID that might already exist on both systems. It is also better to have the same identification number for the group, GID, but this is probably the case already; using Slackware, the default group for users is just “users” with GID equal to 100.

The UID is stored in the /etc/passwd file. On each line of this file is the information for a particular user beginning with the user name. The UID is the third field from the beginning of the line, fields being separated by colons (:). Once you have determined a UID that suits you, edit the /etc/passwd file and insert the proper UID. Assuming the UID 410 on zeus can be used on hermes as well and the GID is 100, there is nothing to change on zeus. Then change ownership of the files in your home directory on hermes by giving the command:

hermes# chown -R 410.100 hermname .

Make sure you issue the command from your home directory or else expect to face some problems. Have a look at the man page of chown to make sure you understand how it works. In the case where you have to change the UIDs on both zeus and hermes, issue the same command from your home directory on zeus.

Note: Make sure that changing ownership won't affect file access for other users. This could cause trouble if you had files or directories that you own but which you share with other users in the same group.

IP Masquerading

I now have two computers, connected using a local network with PLIP, file sharing with NFS. Sounds pretty good, doesn't it? Yes, but we want more.

If we have Internet access from zeus via a PPP connection (or an Ethernet card), we can use zeus as a gateway for hermes to have Internet access. In other words, we can use the PPP connection on zeus from hermes through the parallel cable. We will do this using IP masquerading. This is the subject of a stand-alone article (see “IP Masquerading with Linux” by Chris Kostick Linux Journal July 1996), so I am just going to give pointers to some relevant documentation. See Resources for the web address of the IP Masquerade HOWTO and the Firewall-HOWTO. You will have to recompile the kernel to activate masquerading. Create a /usr/sbin/ipmasq-on.sh script on zeus containing the lines:

#!/bin/sh
ipfwadm -F -p deny
ipfwadm -F -a m -S 192.168.93.0/24 -D 0.0.0.0/0

Invoke the script as root on zeus when the PLIP connection is active. I know this is not enough information, but masquerading is not the subject of this article and the HOWTO contains all the details.

Conclusion

I said in the beginning of the article that I just wanted a temporary connection between zeus and hermes; it looks like I got a little carried away and am close to making it permanent. By the way, I wrote most of this article on hermes, with the file residing on a zeus file system mounted via NFS. Yes, I think it is truly becoming permanent.

Resources

Loris Renggli is a mathematician who holds a Ph.D. in numerical analysis from the Swiss Federal Institute of Technology. For the past four years, he has been teaching and doing research in Switzerland, Finland, France and the U.S. He was last seen at Florida State University as an assistant professor in mathematics. When you will read this article, he will be elsewhere; he prefers to be reached electronically at renggli@math.fsu.edu.

______________________

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix