I installed MySQL3 and PHP4 with an RPM package. Apache is running well and the MySQL server is running well from the shell. PHP4 also runs with the infophp() function call. But I can't connect to the MySQL server. What's wrong? —Haidar AM, haidar@netexecutive.com
You did not mention it, but I am assuming that the phpinfo script showed that you do have support for MySQL. If this is the case, please check the MySQL table to make sure that the user/password/host, localhost in this case, are correct. —Mario Neto, mneto@argo.com.br
I've been handed the task of automating various software tasks for a company and a lot of it will entail emulating keyboard input. How can I echo key commands from a script to a program? I've not even been able to find a thorough list of what keys map to what escape sequences. Can anyone help? —Paul, tanx1@stlnet.com
Try the expect command. Linux Journal published an article about it a couple of months ago [That would be the December 2000 issue, Mario—Ed.]. It comes with most distributions and lets you write scripts so you can automate interactive sessions. —Mario Neto, mneto@argo.com.br
One simple method I use to call some programs from a script is echo "y" | xyz In this case I run xyz, which will, after starting, get a “y” in response to its question. —Usman S. Ansari, uansari@yahoo.com
For some reason I cannot log in as root at my local Linux box (not remote login). I can log in as any user and then su to root. Second, whenever I have to execute any commands like adduser, I have to specify the absolute path as to where the command lies such as (/usr/sbin/adduser). —Devraj Sen, devraj@trihedral.com
The file /etc/securetty is used as a list of terminals from which root is allowed to log in. So, it is possible that the entries for your console logins were removed. Simply put them back in, i.e., to allow root to log in on the first console you should have a line consisting of:
tty1
The reason why your PATH isn't set up properly when you use su is because it isn't being treated as a login shell. So, none of the login files that pertain to root are being read. To have them read, type su - instead. —Andy Bradford, andyb@calderasystems.com
As far as I can tell, most if not all, Red Hat releases have been broken in so far as /sbin:/usr/sbin:/usr/local/sbin has never been in root's path for various reasons. The quick way to fix that is to simply add it to the PATH in /etc/profile. As you cannot log in as root, this is not usual behavior. You should make sure root has a valid shell, and that /etc/securetty still contains “ttyx” lines. For more clues, type tail -f /var/log/messages and look at the output when you try to log in as root from another console. —Marc Merlin, marc_bts@valinux.com
What is the command for synchronizing/updating the shadow file after I create a user account by manually editing the password file? Also, how do I remove the suid bit from any process? —Kedar, kedar.potdar@imandiasia.com
pwconv is the command for synchronizing/updating the shadow file after creating a user account. —Usman S. Ansari, uansari@yahoo.com
To remove the suid bit use chmod -s filename. —Marc Merlin, marc_bts@valinux.com
To protect against accidentally mangling /etc/passwd if someone runs a utility that touches the file at the same time you're editing it, use vipw any time you edit /etc/passwd (it uses your chosen editor, not necessarily vi. —Don Marti, info@linuxjournal.com
I have written a basic Perl program that reads a list of URLs from a file, goes to the URL, looks for some information and then writes that information to another file. It also writes entries to a log file and stdout. I am using the LWP::Simple module. I note the following strange behavior: 1) the log file is not written to immediately—the OS seems to be caching write requests; and 2) the program seems to die after 1-2 hours of perfectly normal operation, but restarting it works fine. —Dave Barter, dave@phased.co.uk
Typing $| = 1 at the beginning of your script will force your Perl program to do a flush after every print or write (see man perlvar). As for why your program is dying, try running top at the same time to see if it's hogging all your memory. If so, rewrite it to forget about pages after it's done with them. If you run your program unattended, you should be using LWP::RobotUA, to respect webmasters' wishes about what parts of their sites are open to robots. —Don Marti, info@linuxjournal.com
I am trying to install Red Hat onto my Dell laptop using the partition I created for it. The install runs successfully, but when I try to load Linux it hangs up after these messages:
checking root filesystem / was not cleanly unmounted, check forced Setting filetype for entry log in /dev (174593) to 6 Unattached inode 82384 UNEXPECTED INCONSISTENCY; run fsck MANUALLY (ie without -a or -p options) An error occured during the filesystem check Dropping you to a shell; the system will reboot Give root password for maintenance
—Brian Weigner, brian.weigner@colorado.edu
Seems your Linux root filesystem was corrupted somehow. You actually need to get into single-user mode by issuing a linux s command at the LILO prompt and wait until you get the # root prompt. Type:
e2fsck -r /dev/your-root-disk-device
This will go through the device and ask you what to do with each error it finds. This will probably ask many questions that should be answered. To properly answer all of them, some Linux filesystem experience is a must. This is risky business on a real production system. For now, since it is a fresh install and to make it easy, answer yes to all the FIX?, and REPAIR? and REMOVE unused/dirty stuff, questions. After you are done, try rebooting your system. If that doesn't work, maybe your best bet is to carefuly reinstall. —Felipe E. Barousse Boué, fbarousse@piensa.com
To prevent this from happening in the future, run shutdown -h now (as root) before you power down. —Don Marti, info@linuxjournal.com
My FTP users are able to back past their home directory and go right to /. They are using leach FTP, and it allows them to go up levels even in their home directory.
Also, I have 20 virtual sites (by name, not IP) running on my Apache server. A couple of times when adding a new virtual host, it would not resolve until I moved it to the top of the list of virtual hosts in httpd.conf. Am I out of virtual servers? The computer is an AMD K6 200MHz with 64MB of RAM. —Aaron, aaron@x56.net
There is a hack in wuftpd to prevent users from cd-ing up, but you are probably better off installing proftpd if you aren't using that yet. It supports chrooting users in their home directory or some other preset directory. See: http://www.proftpd.net/. —Marc Merlin, marc_bts@valinux.com
You're not out of virtual hosts, but this configuration can be tricky. Here are some things to check. Do any of the ServerName or ServerAlias values in the virtual hosts before the broken one match the broken one's name? If you have a ServerAlias *.example.com and add warez.example.com, it won't work. Keep everything with a * alias at the end. Do an nslookup to make sure that the DNS for all the virtual hosts works. Make sure that the NameVirtualHost directive is before the corresponding VirtualHost sections. Read httpd.apache.org/docs-2.0/vhosts/details.html and, of course, every webmaster's most-read and least-enjoyed reading material, error_log. —Don Marti, info@linuxjournal.com
I have a PCTEL internal modem, and I got the drivers from linmodems.org and have installed them. The problem is the modem keeps on dialing with the message NO DIALTONE. I was able to connect only once and that was after trying for a long time. Also, the transfer rate wasn't what I was expecting. —Krishna, as_krishna@hotmail.com
Try to see if adding X1 in your AT init string makes a difference. —Marc Merlin, marc_bts@valinux.com
Increasingly, I see spammers attempting to send mail to my domains by simply trying a series of common first names (i.e., david@example.com, bill@example.com, mike@example.com, etc.) Is there any automated method of shutting down the connection after X failed addresses and, even better, adding their IP to sendmail's access database? —Waldo Jaquith, waldo@waldo.net
You could write a small Perl script that parses the reject log, adds the IP to a blacklist and restarts sendmail when this happens. —Marc Merlin, marc_bts@valinux.com