The Linux BLFAQ Neil Zanella v0.1.3.1, March 27 1998 Copyright Notice: -------------------------------------------------------------------------------- Copyright (c) 1998 by Neil Zanella. This document may be distributed under the terms set forth in the LDP license at Intro: -------------------------------------------------------------------------------- Welcome to the Brief Linux FAQ (BLFAQ)! This document contains a list of some frequently asked Linux questions and their answers. It is meant to provide general help to Linux users, especially newbies. I invite you to modify and add to this list but if you do so please be sure to mail me a copy of the modified list so that I can include your changes in future releases. FAQs: -------------------------------------------------------------------------------- Q: I am trying to use the text based ftp program to download some stuff via anonymous ftp from an ftp site. I have never done this before and the ftp server doesn't seem to be letting me log in. Do I need a special username and password to do this? A: No, anonymous ftp means that you log in with the username "anonymous" without quotations and your full e-mail address as your password. Some ftp sites will also accept the words "ftp" or "guest" instead of the word "anonymous" as username. -------------------------------------------------------------------------------- Q: I plan to use the fips program to shrink a FAT32 partition (such as one used by MS-Windows 95) and hence create space for my Linux operating system. Can this be done? A: Yes, but in order to do this you will need a version of fips at least as recent as fips15c. You can get the latest version of fips by anonymous ftp from bmrc.berkeley.edu in the directory /pub/linux/fat32 -------------------------------------------------------------------------------- Q: I am trying to install Linux via CD-ROM. I have made space for Linux on my hard drive but inserting the Linux CD into the CD-ROM drive and rebooting has no effect. A: You might have to tell your BIOS (Basic I/O System) to enable booting from CD-ROM by changing the default BIOS settings. On most systems you may access the BIOS settings by pressing the key on your keyboard shortly after rebooting. -------------------------------------------------------------------------------- Q: I have completed the installation process but upon reboot I get a LI prompt or a bunch of zeros and ones. A: If your machine is somewhat old and you have an IDE (or EIDE) hard drive then you must install your root partition completely below cylinder 1023 which means below 512MB of disk space. On SCSI drives this means your root partition must be contained within approximately one GB. If your machine is fairly new and your BIOS supports it you may be able to get around this problem by enabling LBA mode in the BIOS settings. -------------------------------------------------------------------------------- Q: My new video card is listed at as a card which the X Window System supports under Linux but I cannot get it to work. A: Make sure that you have the newest version of XFree86 and that you installed the right X Server. If all else fails you might want to try selecting the generic SVGA server as your X Server. -------------------------------------------------------------------------------- Q: I have successfully installed the X Window System and use the startx command to run it from a text based virtual console. How can I have the X Window System run at all times so that I don't have to use the startx command? A: If you are running Red Hat then you can edit the file /etc/inittab on your system and replace the entry id:3:initdefault: with the entry id:5:initdefault: and reboot. On other systems you might have to change the number 5 (the runlevel) to another number like 4. How to choose the correct runlevel should be clear by reading the comments in the file /etc/inittab . Alternatively, you might have to change a link in /etc/rc[2345].d . Runlevels 2-5 don't have really strong conventions behind them like 0, 1, and 6 do. It depends on the distribution. -------------------------------------------------------------------------------- Q: When I use the X Window system and open multiple windows I find that my screen size is insufficient. How can I use more virtual screen space? A: Most window managers running under X Window have a built in feature known as a pager which allows you to have more virtual screen space. -------------------------------------------------------------------------------- Q: I would like to have xdm run multiple local diplays on my system and switch back and forth by pressing where * is a number between 1 and 12. A: If you wanted to run 6 virtual consoles accessible by pressing the keys through then you could put the following entries in the file /usr/X11R6/lib/X11/xdm/Xservers :0 local /usr/X11R6/bin/X vt07 :0 :1 local /usr/X11R6/bin/X vt08 :1 :2 local /usr/X11R6/bin/X vt09 :2 :3 local /usr/X11R6/bin/X vt10 :3 :4 local /usr/X11R6/bin/X vt11 :4 :5 local /usr/X11R6/bin/X vt12 :5 I would limit myself to only a few of these though as X seems to eat up quite a lot of memory when multiple displays are running. -------------------------------------------------------------------------------- Q: I hate the sound of the bell. I would prefer to disable it perhaps enabling the visual bell as an alternative. A: If you are running X then you can simply type "xset -b" without quotation marks at the command prompt. Alternatively, if you are running the bash shell then you can add the command "xset -b 2> /dev/null" without quotation marks at the end of your .bash_profile file in your home directory to have the audible bell disabled each time you log in. For more information see the Visual-Bell-mini-HOWTO at -------------------------------------------------------------------------------- Q: I have access to a remote unix machine that has some commercial software that uses X which I would like to run remotely on my display. How do I do it? A: First connect to the remote machine using dip or whatever you use. If the remote machine is called grasshopper.uvw.edu and your machine is called kiwi.fruit.org then first type xhost +grasshopper.uvw.edu from your own machine's shell prompt while running X. If you telnet to the remote machine and you're using a modem to connect then your machine name on the internet may be different from your actual machine name at home so be sure to use the finger command on the remote machine with your remote username as an argument to find out what your machine name is on the internet. Assuming your machine name has not changed you must type export DISPLAY=kiwi.fruit.org:0.0 on the remote machine if it uses the Korn shell or the equivalent if it uses another shell. You should be now ready to fire up the remote application from your machine. -------------------------------------------------------------------------------- Q: I have more than 64 MB of RAM but when I use the "free" command to check the amount of available memory on my system only slightly less than 64MB show up. How do I get Linux to recognize the additional RAM? A: Linux uses the BIOS to detect the amount of available RAM. At the present time there are two separate function calls available to do the job. Any version of Linux prior to 2.1.x uses the old call which is limited to 64M. The newer call (used by 95/NT and Linux 2.1.x) can return more than 64M. This problem should be fixed in the next stable release of the Linux kernel (release 2.2.0). For now it is possible to have Linux detect all of your RAM by adding the line: append = "mem=128M" to the file /etc/lilo.conf if you use LILO or to the end of the respective LOADLIN file if you use LOADLIN. This will enable 128MB of RAM, for example. You will need to rerun LILO for the changes to take effect. The next time you boot up, Linux will see all of your memory. -------------------------------------------------------------------------------- Q: I have used the rm command to delete a file. Is it possible to undelete the file and hence recover its contents? A: In theory there is a way to undelete a file if you are using the ext2fs file system (most common). In practice, it is rarely possible. To prevent significant loss of data in this manner you must ensure that your system is backed up regularly. Alternatively if you had installed the program midnight commander before deleting and compiled a version with undelf then you could use cd undel:/dev/hda8 to see your deleted files (without names). Alternatively, some users like to have a shell script that moves a file to a directory like /tmp each time it is removed or just before it is overwritten. If you are really desparate, read the Ext2fs-Undeletion mini-howto, which might work. -------------------------------------------------------------------------------- Q: I am trying to run a script file named script or test but I am getting some unexpected results. A: The names script and test are names of executable prgrams on your system so you should not use them for your own executables. If you got unexpected it's because the system binaries got to be executed before your own binaries. -------------------------------------------------------------------------------- Q: I removed Linux from my system, but now DOS won't boot because LILO is still there. How do I remove LILO? A: If you have a version of DOS at least as recent as DOS 5.0 then you can insert your DOS boot diskette and boot from it. At the DOS prompt, type fdisk /mbr to remove LILO from the Master Boot Record (MBR). -------------------------------------------------------------------------------- Q: I want to add '.' to root's PATH, to allow me to not have to put ./ in front of every local command I type. But I hear this is a bad thing. Why? A: Adding '.' to root's PATH would be a security risk. Imagine the case where a malicious user creates a file called /tmp/ls containing a command sequence such as # Caution: This script removes everything from the Linux filesystem. cat /tmp/ls rm -Rf / and you as root wander into temp and want to see what files are there. If the . occurs in root's path before /bin then typing ls at the shell prompt will execute the malicious command instead. Alternatively, the malicious command could be named mroe, ls-l, caat, lss, or similar in which case a typo on root's behalf would cause it to be executed even if . is the last entry in root's path. Finally, the mailicious command may be set to copy /bin/bash to a hidden spot and change permissions of the copy to suid ( -rws---r-x ) so that anyone executing the hidden copy would have root permissions. -------------------------------------------------------------------------------- Q: I can't execute my script/program. I can list the file with ls -l and it is there with the correct permissions: ls -l mumble -rwxrw-r-- 1 me user 104 Feb 14 15:46 mumble but when I type mumble at the command prompt I get the reponse: bash: mumble: command not found A: Most probably the current directory (CWD) is not in your path. The best thing to do in such situations is probably to type the full path to the script/program followed by the name of the script/program . If you are work in a directory that you alone use and which is not shared then you might want to take the risk of editing your PATH variable to contain CWD. Alternatively you could keep all your executables in a directory called ~/bin and put it in your path. You can look at your path by typing echo $PATH at the shell prompt. echo $PATH /usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/me/bin -------------------------------------------------------------------------------- Q: Why can't I telnet or rsh in to my Linux system as Root? A: This is a security feature meant to protect you. Malicious users must know a valid user password, as well as the root password in order to get in to the system and do anything as root. Log in as a user, and use the su command to then become root. Better still is to use the ssh command (if installed) which encrypts your session to prevent anyone from seeing the root password. If your network is totally local (you have only a terminal connected to a serial port), you can edit /etc/securetty to add that port as one considered secure enough for root to log in. -------------------------------------------------------------------------------- Q: Why can't I ftp as root? A: This is a security feature meant to protect you. No user listed in /etc/ftpuser is allowed to use ftp. Always ftp as a regular user. -------------------------------------------------------------------------------- Q: I've tried to create a shell script and made it setuid root so the users can execute it. But no matter what I do, it doesn't execute with root privliage. Why? A: Shell scripts are a notorious security hole. To protect you, the kernel purposely ignores setuid and setgid in scripts. Create a C or Pearl program to do the task. -------------------------------------------------------------------------------- Q: Why should I create ordinary user accounts. I'm the only user on this machine. Why not just work as root? A: Root, commonly called the super-user, is for system administration tasks only. The normal protection mechanisms are eliminated for this account (indeed for any user with UID or GID equal to 0). So if you make any little mistake (for example the classic "rm * myfile" -- note the space between the wild-card and myfile) the system will do _exactly_ what you told it to do, not what you meant it to do. In the classic mistake above, the system will remove all files in the current directory, then complain because it can't remove 'myfile' which doesn't exist. -------------------------------------------------------------------------------- Q: I am able to establish a dial up connection but when I use telnet to connect to remote hosts telnet understands IP address but not host names. What can I do to have telnet and other programs understand host names? A: You should be able to get rid of this problem by adding an entry for a name server in the file /etc/resolv.conf . If you have more than one name server then you should put your primary dns first as nameserver entries get read from top to bottom. The 'search' or 'domain' line should have your isp's domain name. Your /etc/resolv.conf should look something like: search virtual-impact.com domain virtual-impact.com nameserver 205.162.94.51 nameserver 205.162.88.33 nameserver 134.153.2.90 -------------------------------------------------------------------------------- Q: I don't like having to type the full hostname when using telnet. How can I resolve this problem? A: Edit the file /etc/hosts and add entries like the following: 127.0.0.1 localhost localhost.localdomain 134.153.1.200 riemann riemann.math.mun.ca 134.153.39.1 ganymede ganymede.cs.mun.ca 134.153.1.1 garfield garfield.cs.mun.ca 134.153.2.151 plato plato.ucs.mun.ca 129.128.88.12 vega vega.math.ualberta.ca -------------------------------------------------------------------------------- Q: I am logged into a host. I would like to find out its IP address and a few other ones. How can I do this? A: You could use the hosts command as follows: ganymede $ host ganymede.cs.mun.ca ganymede.cs.mun.ca has address 134.153.39.1 ganymede.cs.mun.ca mail is handled (pri=5) by garfield.cs.mun.ca ganymede $ The programs nslookup and /sbin/ifconfig can also be used for this purpose. -------------------------------------------------------------------------------- Q: How can I have the "useradd" or "adduser" command automatically place some default files in a user's directory when that user is added to the system? A: Edit the contents of the files located under /etc/skel to suit your needs. These files will be added to a user's home directory each time that user is added. -------------------------------------------------------------------------------- Q: I have read the Brief Linux FAQ (BLFAQ) but could not find what I was looking for. Where else should I look? A: Other places include links under including the Linux FAQ (LFAQ) and the various HOWTOs and mini-HOWTOs. Other sites of interest might include for X related things and i ftp://sunsite.unc.edu if you're looking for interesting applications to run under Linux. -------------------------------------------------------------------------------- Hope this helps, -- maintained by: Neil Zanella e-mail: nzanella@ganymede.cs.mun.ca comp.os.linux.answers . I have included it below: Neil Zanella nzanella@ganymede.cs.mun.ca