Best of Technical Support

Various

Issue #57, January 1999

Our experts answer your technical questions.

umask Trouble

I'm trying to use umask to set permissions in a directory, but it doesn't allow me to set execute. I use

umask a=rwx

and when I create a new file the permissions are -rw-rw-rw-.

Can you give me a quick explanation of this command? Thanks. —Ernesto Jardim, ernesto@ipimar.pt

umask doesn't set permissions; it uses a mask to clear existing file permissions. The umask is also used by the shell to set initial file permissions on a newly created file. Specifically, permissions in the umask are turned off from 0666. The default umask is commonly 022 (in octal notation). In binary it is 000 010 010 which is equivalent to ----w--w-. When a file is created, the default permissions are rw-rw-rw- (666) and after the umask is applied, they will be rw-r--r-- (644). To set permissions, use the chmod command.

IDE/ATAPI Support?

I have two technical questions that I can't seem to solve by reading HOWTOs.

1) Has anything been done for the IDE/ATAPI version of the Iomega Zip drive? Every HOWTO I have read seems to cover only the SCSI and the parallel port versions.

2) I have an HP ScanJet 5P scanner, with complementary Symbios one device SCSI controller. When I boot Linux, it says it doesn't detect any SCSI hosts. Is this normal and what is the reason behind it? —Henk Verleye, henk@sophis.be

1) Newer kernels (like 2.0.35) support IDE/ATAPI removables. Just include IDE/ATAPI FLOPPY support and recompile the kernel.

2) Frankly, I don't know if this type of SCSI controller is supported, but if it is, make sure the ncr53c8xx SCSI driver is compiled into the kernel.

Switching Hard Drives

I have one hard drive for Linux Red Hat 5.0 and one for Windows and want to switch them. Linux is on hda1 and Windows is on hdb1. hdb1 is the faster of the two, and I want to move Linux to it and put Windows on hda1. I know how to do the Windows part, but how do I duplicate everything on hda1 to hdb1? hdb1 is a bigger hard drive and has more than twice the speed of hda1. —Jon, LordShroom@hempseed.com

First boot Linux, then mount hdb1 under /mnt with mount /dev/hdb1 /mnt; then, if one partition is all you need to copy, type the following:

cp -a --one-file-system / /mnt

Wait for the copy to finish, then type umount /mnt. If you have more than one file system you want to copy, you have to repeat this for each partition. Now you need to change /etc/lilo.conf so that LILO boots from hdb1 instead.

Mounting a Zip Disk

I am using Red Hat 5.1 and am having some difficulty mounting a Zip disk formatted in Windows 98. The file system is not FAT32; it is FAT16. I can easily mount a Linux EXT2 Zip, but not the Windows 98 one. I'm not sure if I have the relevant information in my FSTAB—maybe someone can tell me what I need. I've used commands like:

mount -t msdos

I've tried many variations of this with no success. Is there something I'm missing? The man mount help seems informative, but yields no solutions —Edward Heshka, heshka@idirect.com

The default partition used on a Zip disk under DOS/Windows is the fourth partition. Don't ask me why! Add entries similar to these to your /etc/fstab:

/dev/sdc1 /zip ext2 noauto,rw,user,nosuid,sync
/dev/sdc4 /zipdos msdos noauto,rw,user,nosuid,sync,mode=0777

Make sure the mount points exist and you use the correct SCSI device. Check the messages during bootup if you're not sure. Now you can mount a DOS Zip disk with mount /zipdos and an EXT2 Zip disk with mount /zip.

Sharing Directories

I'm fairly new to Linux. I have succesfully installed Red Hat Linux 5.1 on my laptop and have configured X appropriately. I have made appropriate network settings and I want to use network shares (i.e., directories) that exist in my company's Windows NT domain. Any suggestions would be greatly appreciated. Also, we use MS Exchange for our e-mail and I have had limited success in configuring a POP3 client to hit the server. Thanks in advance. —William B. Winslow, bill.winslow@atkearney.com

One word: SAMBA. You can find information on SAMBA at http://www.samba.bst.tj/samba/samba.html. Also, read the review in Linux Journal of John Blair's book SAMBA: Integrating UNIX and Windows to see if it is a resource you are interested in using.

Shutting Down

I am using Red Hat 4.2. I would like to give a user who is not root the permission to shut down the system. The man page says, “write the name of the user in the file /etc/shutdown.allow”. Unfortunately, this has no effect, i.e., the user gets the message “must be root” after typing shutdown. —Thomas Okon, okon@math.tu-dresden.de

The only way I know of for any user to correctly shut down a Linux system is to be physically present at the keyboard and press ctrl-alt-del. This key sequence has the effect of running shutdown from init(8). This is the default behavior and all /etc/shutdown.allow does is to restrict ctrl-alt-del even more to specifically named users.

Updating Web Site

I am using Red Hat 5.0. How can I write a script that compares two directories recursively, one on the localhost, the other on an FTP site, then upload only the newer files to the FTP site? I wish to easily update my web site which is getting quite large and difficult to update manually. —Grim_Sweeper@softhome.net

The good news is the solution is already available. The bad news is that you will have to configure it to fit your needs. I'm talking about the mirror package available at ftp://src.doc.ic.ac.uk/packages/mirror/mirror.tar.gz. This is an excerpt from the man page:

Mirror was written for use by archive maintainers but can be used by anyone wanting to transfer a lot of files via ftp. Regardless of how it is called, mirror always performs the same basic steps. It connects to the remote site, internally builds a directory listing of the local target directory, builds one for the remote directory, compares them, creates any subdirectories required, transfers the appropriate files (setting their time-stamps to match those on the remote site), creates any symbolic links, removes any unnecessary objects and finally drops the connection.