FAQforge provides answers for frequently asked questions for the Linux-, MAC and Windows operating systems.

How to enable SSH on VMware ESXi Server

Friday, January 14, 2011 - posted by rafael

wrote by Rafael Marangoni, from BR Link team.

By default, the ssh login is disabled on VMware ESXi, in opposite way what it happens on VMware ESX Server.

But, there’s a way to enable SSH Login.

After the system is installed, go to the console screen and type:

ALT + F1

After that, a Black screen will appear (be calm, that is normal), then type:

unsupported

Next, the Server will prompt for root password. Then you type the root password.

Afterwards, you’ll have shell access. We need to edit the following file:

vi /etc/inetd.conf

Uncomment the line that starts with “SSH”. Save the file (it’s a normal vi, ZZ will do that for you).

Now reboot the server:

reboot

After it reboots, you should login with SSH on port TCP/22, and user root.

Updating Samba on CentOS 5

Friday, January 14, 2011 - posted by rafael

wrote by Rafael Marangoni, from Servidor Linux team.

This article explains howto update the Samba packages on CentOS 5 to version 3.5.

First, we need to add a new repository:

cd /etc/yum.repos.d/

wget http://ftp.sernet.de/pub/samba/3.5/centos/5/sernet-samba.repo

Then, update samba:

yum update samba

Probably, you will need winbind too:

yum install samba3-winbind samba3-utils

Check the rpm version:

rpm -qa | grep samba

Restarting Samba:

/etc/init.d/smb restart

Configure PostgreSQL to accept connections from network

Tuesday, January 11, 2011 - posted by rafael

wrote by Rafael Marangoni, from Consultoria Linux team.

By default, on some distros, PostgreSQL will only accept connections from localhost. When you have only access from localhost (from localhost Apache, by example) everything is ok, but when you need that postgresql accepts connections for other hosts, you need to make some configs.

First of all, edit the postgresql.conf file (on CentOS the default location is /var/lib/pgsql/data/postgresql.conf).

vi /var/lib/pgsql/data/postgresql.conf

Search the following line:

listen_addresses = 'localhost'

Change it to:

listen_addresses = '*'

Secondly, you need to change the permissions inside pg_hba.conf file (on CentOS, the default location is /var/lib/pgsql/data/pg_hba.conf)

vi /var/lib/pgsql/data/pg_hba.conf

Include the following line (at the end of the file):

host    username    all         192.168.0.10/32     md5

Where:
username: it's the name of the postgres user

all: the database name (here we enabled all of them)
192.168.0.10/32: is the IP address/subnet to accept connections
md5: is the method of authentication (md5 requests password)

Reconfigure rkhunter to avoid false positive warnings on Debian 5.0

Wednesday, October 20, 2010 - posted by Till

When you run rkhunter on Debian Linux, you might get a warning when rkhunter is checking for hidden files and directories that some Hiffen files were found in /proc. A closer investigation in rkhunter might bring up the filenames /dev/.static, /dev/.udev and /dev/.initramfs which are normal files on Debian and not related to a attack on your system. The warnings in rkhunter.log are:

[10:21:40] Warning: Hidden directory found: /dev/.static
[10:21:40] Warning: Hidden directory found: /dev/.udev
[10:21:40] Warning: Hidden directory found: /dev/.initramfs

To avoid these warnings, you can reconfigure rkhunter to ignore these files by editing the rkhunter.conf file:

vi /etc/rkhunter.conf

and remove the # in fron of the following lines:

ALLOWHIDDENDIR=/dev/.udev
ALLOWHIDDENDIR=/dev/.static
ALLOWHIDDENDIR=/dev/.initramfs

Create a file of a specific size with random content

Friday, September 17, 2010 - posted by Till

Today I tested the logrotation of a Linux server installation and therefore I needed a logfile that was larger then 10 MB. To create such a file of e.g. 11 MB size on the shell, I used this command:

dd if=/dev/urandom of=test.log bs=1M count=11

The content of the file are random characters. If you need a file filled with zeros, use this command:

dd if=/dev/zero of=test.log bs=1M count=11

The result is a file named test.log in the current directory with a size of 11 MB.

If you get the error message "connect to mysql server 127.0.0.1: Too many connections" in a log file, e.g. the mail.log file, then the max. number of mysql database connections on your server is reached. To increase the max. number of simultanious connections, edit the MySQL my.cnf file:

vi /etc/mysql/my.cnf

and add or change the lines for mysql max_connections and max_user_connections in the [mysqld] section of the my.cnf file:

[mysqld]
......
max_connections = 500
max_user_connections = 500
.......

How to solve the PHP XCache error: /dev/zero: No space left on device

Wednesday, September 1, 2010 - posted by Till

If you get the error "/dev/zero: No space left on device" in the apache error.log on a OpenVZ virtual machine, then the shared memory size in the xcache.ini is too high or the xcache.mm_path is set wrong.

Edit the file /etc/php5/conf.d/xcache.ini

vi /etc/php5/conf.d/xcache.ini

and check the mm_path. On a OpenVZ virtual machine it should be set to "/tmp/xcache" as /dev/zero might not work correctly in a virtual machine:

xcache.mmap_path = "/tmp/xcache"

Then restart apache2:

/etc/init.d/apache2 restart

and check if the error has been resolved.

If the roor still occurs after some time, you will have to reduce the xcache.size.

Edite the xcache.ini file:

vi /etc/php5/conf.d/xcache.ini

and set xcache.size to e.g. 8 MB

xcache.size  =                8M

Then restart apache2:

/etc/init.d/apache2 restart

Secure /tmp and /dev/shm directories in a OpenVZ enviroment

Tuesday, August 31, 2010 - posted by Till

The /tmp and /dev/shm directories of a OpenVZ virtual machine shall be mounted without suid and exec permissions. To achieve this, create a a shell script on the host server for every virtual machine which contains the commands to remount the directories. This script will be started automatically by openvz when the VM is started.

I will use VPSID as placeholder for the ID of the virtual machine in the commands and the script. Replace VPSID with the id of the virtual machine that you want to create the script for, e.g. replace VPSID with 101.

Create the script:

vi /etc/vz/conf/VPSID.mount

and insert the following lines:

#!/bin/bash
mount -n --bind -onosuid,noexec /vz/vps/VPSID/tmp /vz/root/VPSID/tmp
mount -n --bind -onosuid,noexec /vz/vps/VPSID/shm /vz/root/VPSID/dev/shm
exit ${?}

now make the sscript executable:

chmod 700 /etc/vz/conf/VPSID.mount

Migrate physical server system to OpenVZ virtual machine

Tuesday, August 31, 2010 - posted by Till

In case you plan to virtualize your server infrastructure and migrate physical servers to OpenVZ virtual machines, you may find this tutorial helpful:

http://wiki.openvz.org/Physical_to_container

I used this to migrate a ISPConfig Debian system to OpenVZ successfully.

Use separate configurations by network in the Windows 7 firewall

Thursday, July 15, 2010 - posted by Till

The Windows 7 Firewall allows separate configurations by network. This feature makes it possible to configure different firewall rules for the home network , the networkwork or a public network and Windows will apply these rules automatically when the computer gets connected to a different network. To configure the firewall by network, click on Start > Control Panel > System and Security > Windows Firewall

Then Click on "Allow a program or feature trough Windows Firewall" to get the list of open firewall ports for all configured networks.

If the application that shall be able to connect to a specific network is listed there, then allow access by enabling the checkbox in the column of the network. If the application is not in the list, click on "Allow another program" and then select the program in the list that pops up.