UNIX Hints & Hacks

ContentsIndex

Chapter 2: Networking

 

Previous ChapterNext Chapter

Sections in this Chapter:

2.1 OSI Networking Model

 

2.4 Remote Network Configurations

 

2.7 Unmounting and Busy Devices

2.2 Finding the Failure

 

2.5 Shutdown, Halt, or Reboot over the Network

 

2.8 Static Routing or routed

2.3 Hiding Files with NFS

 

2.6 Talking NFS3 to NFS2

 

2.9 Get the Ethernet Address with arp

 

2.3 Hiding Files with NFS

2.3.1 Description

2.3.1 Description

This is a sneaky little trick for hiding files beneath a NFS mount point.

Flavors: AT&T. BSD

Syntax:

mount fsname dirname
umount fsname | dirname

I have seen this used time and again by tactful users to conceal their files from others. To the average user, the files do not even exist. To an administrator, the hidden files can provide a frustrating problem to what seems to be no answer. I will tell you later why this is.

Suppose you have a list configuration of files down a tree that you want to conceal.

# cd /configs/private/systems
# ls
sky     thunder     rain     storm
# df . Filesystem Type kbytes use avail %use Mounted on /dev/dsk/dks0d3s0 xfs 2051936 1905636 146300 93 /

Take the top level directory of the tree "/configs" and make it a mount point to a dummy area off a remote system.

# mount missile:/configs /configs
# cd /configs
# ls
README     data.conf
# df . Filesystem Type kbytes use avail %use Mounted on missile:/configs nfs 1968162 1655887 312275 85 /tmp_mnt/hosts /missile/configs

Now when you go to the mounted filesystem, the original files vanish and are replaced with new files. They really aren't though. They are merely hidden underneath the remote mount point and are still there.

# umount missile:/configs

To be able to see the original hidden files again, use the unmount command and the NFS mount is removed exposing the directory tree as it truly is.

Reason

On most UNIX platforms, NFS mount points have to be only a directory on the local drive. It does not matter whether the directory contains data or not. It needs to have only a directory off of which it can create the mount point.

Real World Experience

I run into this at least once a year. The funny thing is that every year it is caused by the same exact thing: Images. Gigabytes of images that do not adhere to standard company policy. I shouldn't have to go into any more detail about the images, because we've probably all found images that don't meet company policy.

This little hack has been exposed in two ways so far. By either the system drive crashing from lack of disk space, or the user requesting help to clean up the disks. In every case, the disks were full. It gets frustrating when you aren't expecting this hack.

After you remove all the files that you can without causing damage to the operating system, you use the df command and find that you haven't even made a dent in the amount file space being used. This is the time when you need to make sure that the results of the df command match the results of the du command. If they don't match, immediately unmount all the NFS mounted filesystems. If you have the ability to go into single user, this is also advisable; check your df and du commands again. Be careful when you use du, because it follows NFS mount points and can add to the confusion.

Other Resources

Man pages:

df, du, mount, umount

UNIX Hints & Hacks

ContentsIndex

Chapter 2: Networking

 

Previous ChapterNext Chapter

Sections in this Chapter:

2.1 OSI Networking Model

 

2.4 Remote Network Configurations

 

2.7 Unmounting and Busy Devices

2.2 Finding the Failure

 

2.5 Shutdown, Halt, or Reboot over the Network

 

2.8 Static Routing or routed

2.3 Hiding Files with NFS

 

2.6 Talking NFS3 to NFS2

 

2.9 Get the Ethernet Address with arp

 

© Copyright Macmillan USA. All rights reserved.