Best of Technical Support
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, email@example.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, firstname.lastname@example.org
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, email@example.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, firstname.lastname@example.org
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, email@example.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, firstname.lastname@example.org
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:
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, email@example.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, firstname.lastname@example.org
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, email@example.com
pwconv is the command for synchronizing/updating the shadow file after creating a user account. —Usman S. Ansari, firstname.lastname@example.org
To remove the suid bit use chmod -s filename. —Marc Merlin, email@example.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, firstname.lastname@example.org
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, email@example.com
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, firstname.lastname@example.org
Practical books for the most technical people on the planet. Newly available books include:
- Agile Product Development by Ted Schmidt
- Improve Business Processes with an Enterprise Job Scheduler by Mike Diehl
- Finding Your Way: Mapping Your Network to Improve Manageability by Bill Childers
- DIY Commerce Site by Reven Lerner
Plus many more.
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Happy GPL Birthday VLC!
- Handheld Emulation: Achievement Unlocked!
- Unikernels, Docker, and Why You Should Care
- Giving Silos Their Due
- Controversy at the Linux Foundation
- Don't Burn Your Android Yet
- New Products
- Non-Linux FOSS: Snk
- diff -u: What's New in Kernel Development