Archive for the 'tips and tricks' category

Tips and tricks: How can I find the label name of my swap partition?

To find the label of a partition, use this command:

# blkid -s LABEL /dev/<partition>

Replace <partition> with the name of the swap partition.

This command will also work with any other type of partition

» Read more


Tips and tricks: Can I use a non-admin user account on my APC power supply for Red Hat Cluster Suite fencing?

No, the fence_apc script requires that the admin user (typically called apc) be used for fencing. Regular users have a different menu interface than the admin user and the fencing agent is incompatible with this interface.

To avoid exposing the admin password in the cluster configuration file, a password script can be used. This script needs execute permissions for root only preventing others from reading or executing it. The script can be as simple as:

#!/bin/bash
echo "mypassword"

Once it is in place, use system-config-cluster or Conga to edit the fence device properties. There is an option to specify a password script instead of the clear text password.

» Read more


Tips and tricks: How do I run a script as a certain user when it is called by another user with sudo?

If a script that has been written needs to be run as a particular user, the /etc/sudoers file needs to be modified to include default user options.

Edit the /etc/sudoers file by invoking:

#visudo

In this example, SCRIPT1 is the script that will be executed. TESTUSER is the alias of users who have permission to execute the script via sudo and test is the user that the script must be run as.

Cmnd_Alias SCRIPT1=/bin/blah.sh
User_Alias TESTUSER=test,test1,test2
Defaults:TESTUSER runas_default=test
TESTUSER ALL=NOPASSWD: SCRIPT1

If the sudo /bin/blah.sh command is invoked by the test, test1, or test2 users it will run as user test.


Tips and tricks: Why does connecting to Red Hat Enterprise Linux Samba servers no longer work from Windows Vista clients after installing Service Pack 1?

This Red Hat Knowledgebase article applies to Red Hat® Enterprise Linux® versions 4 and 5.

Microsoft® Windows® Vista Service Pack 1 (SP1) introduced additional authentication principals and differences in the methods used to encode and decode packets between peers as default behavior. The result is that Windows Vista clients cannot properly authenticate or access shares on Samba servers of versions prior to 3.0.28 once SP1 has been installed.

Solution

Red Hat Enterprise Linux version 4 Update 7 and version 5 Update 2 will include Samba version 3.0.28, which addresses these interoperability issues and others seen with prior Samba versions.

Red Hat Enterprise Linux 4 and 5 customers experiencing significant impact to their operations involving Samba servers and Windows Vista clients after installation of Windows Vista SP1 are encouraged to contact Red Hat Global Support if a solution is required before the next update release. » Read more


Tips and tricks: How do I set default password expiration for new accounts?

To set the default password expiration when creating new accounts on Red Hat® Enterprise Linux®, edit the /etc/login.defs file.

For example, to set the default maximum number of days a password may be used, change the following parameter in login.defs:

PASS_MAX_DAYS 30

To set the default number of days warning given before a password expires, change the following parameter in login.defs:

PASS_WARN_AGE 7

Please refer the man page of login.defs for more parameters about default password expiration. » Read more


Tips and tricks: How do I check the software integrity on Red Hat Enterprise Linux 5?

There is an integrity checking software called AIDE shipped by Red Hat® Enterprise Linux® 5. AIDE provides some general strategy for implementing integrity checking to detect the intrusions when they have occurred. » Read more


Tips and tricks: How do I find information (version, etc.) about php?

To get information about the version of PHP installed on the system, create a php file on the web server called phptest.php with the following code in the file:

<?

phpinfo();

?>

Save the file and open it from a web browser. This will display information about php.


Tips and tricks: How do I resize multiple image files using command-line tools?

Image file size depends on the amount of image details it has. The higher the image quality, the better the resolution but the larger the resulting file size. Web galleries tend to load very slow and sometimes inaccessbile if photos have very high resolutions.

The mogrify command allows users to resize multiple image files at once. mogrify comes with the ImageMagick package. ImageMagick is a program used to resize, rotate, manipulate and display images. It can read, convert and write images in JPEG, TIFF, PNM, GIF and other Photo CD image formats. » Read more