Archive for October, 2010

SBDavid

How to Disable IPv6 in Apache Server

How to Disable IPv6 in Apache Server

If there is no reason to run Apache with IPv6 then disabling it is wasy. We need to make quick changes to the Listen directive.

By default, Apache will listen on all IPs, both IPv6 and IPv4. (Assuming your system has IPv6 support). This is controlled by the Listen directive:

Listen 80

Turn off IPv6 in Apache

To turn off IPv6 in Apache, just change the Listen directive to:

Listen 0.0.0.0:80

This will limit Apache to listening only to IPv4 connections. We can repeat this for port 443 if you want to stop Apache from listening for HTTPS on IPv6.

Finding help content for MySQL databases administration.

Run ‘help contents’ for a list of all accessible topics

mysql> help contents

You asked for help about help category: “Contents” For more information, type ‘help [item]‘, where [item] is one of the following categories:
Account Management
Administration
Compound Statements
Data Definition
Data Manipulation
Data Types
Functions
Functions and Modifiers for Use with GROUP BY
Geographic Features
Language Structure
Table Maintenance
Transactions
User-Defined Functions
Utility

To go to the individual catefories run the following example command.

mysql> help Account Management

You asked for help about help category: “Account Management” For more information, type ‘help [item]‘, where [item] is one of the following topics:
CREATE USER
DROP USER
GRANT
RENAME USER
REVOKE
SET PASSWORD

Creating and editing users in MySQL from shell prompt.

First we need to login into MySQL server as root.

mysql -u root -p

Will be prompted for your MySQL root password (note this is not the same as the server root password).

mysql> create user ‘buddy@localhost’ identified by ‘new-password’;
Query OK, 0 rows affected (0.12 sec)

Next we need to flush the privileges which reloads the ‘user’ table in MySQL - do this each time you add or edit users.

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

To give the user buddy select permission on all the databases, this allows the user to read, but not edit and delete.

mysql> grant select on *.* to ‘buddy’@'localhost’;
Query OK, 0 rows affected (0.00 sec)

The GRANT statement enables system administrators to create MySQL user accounts and to grant rights to accounts. To use GRANT, you must have the GRANT OPTION privilege, and you must have the privileges that you are granting. The REVOKE statement is related and enables administrators to remove account privileges.

SBDavid

How to check SELinux Status

How to check SELinux Status

Use the command below to check the current status.

# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: permissive
Mode from config file: permissive
Policy version: 21
Policy from config file: targeted

We can also change the policy using setenforce command.

setenforce 0 - to disable
setenforce 1 - to enable

# setenforce –help
usage: setenforce [ Enforcing | Permissive | 1 | 0 ]

How to find World/Group writable files and directories.

Finding world-writable files and directories

#find / -type f \( -perm -2 -o -perm -20 \) -exec ls -lg {} \;

#find / -type d \( -perm -2 -o -perm -20 \) -exec ls -lg {} \;

This will create a huge file with permission of all files having either write permission set to the group or everybody. Check the permissions and eliminate world writable files to everyone, by executing /bin/chmod on the files.

To remove the permission execute.

#/bin/chmod o-w [file-name]

« Prev - Next »