Unable to start SSH: /dev/null is not a character device

Posted by admin     Category: VPS Management

The “/dev/null is not a character device” message occurs in a VPS when an upgrade is performed and the /dev/null turns into a regular file.

# /etc/init.d/sshd restart
Restarting Secure Shell server: sshd failed!
/dev/null is not a character device!.

The /dev/null should be a character device as per the Linux standards. To fix the issue, remove the file

# rm -f /dev/null

Create the character device

# mknod /dev/null c 1 3

The file should look like follows:

# ls -la /dev/null
crw-rw-rw- 1 root root 1, 3 Oct  1 11:42 /dev/null

Now restart the sshd service

# /etc/init.d/sshd restart
Stopping sshd:              [  OK  ]
Starting sshd:              [  OK  ]

How to add a sub-domain in Plesk with www prefix?

Posted by admin     Category: Plesk Management

Generally, a sub-domain is not accessed using the www prefix i.e. you can access subdomain.domain.tld but cannot access www.subdomain.domain.tld by default. To make a subdomain work with ‘www’ prefix on a Plesk server, you have to add a ServerAlias entry in the vhost configuration of the sub-domain and add an A record from Plesk.

Solution:

1. Create a vhost.conf file for the sub-domain

# nano /var/www/vhosts/domain.tld/subdomains/<sub-domain>/conf/vhost.conf

and add a ServerAlias entry

ServerAlias www.subdomain.domain.tld

2. Add an ‘A’ record for the ‘www’ prefix of the sub-domain from Plesk -> Domains -> <domain.tld> -> DNS Settings -> Add Record

www.subdomain.domain.tld A 1.1.1.1

3. To apply the ServerAlias changes, run the websrvmng utility

# /usr/local/psa/admin/bin/websrvmng -a

4. Restart the webserver

# service httpd restart

Replace the subdomain/domain name and the 1.1.1.1 IP with the actual values.

Howto: find the Linux kernel version?

Posted by admin     Category: Linux Administration

The ‘uname’ command is use to determine certain system information in all the Linux/Unix flavours like CentOS, Ubuntu, Debian, Fedora, FreeBSD etc. With specific ‘uname’ options, you can display all the details of the current working kernel on the server.

To display the working kernel name, version, date and time, system architecture type, use:

# uname -a
Linux server.domain.tld 2.6.18-164.11.1.el5 #1 SMP Wed Jan 20 07:39:04 EST 2010 i686 i686 i386 GNU/Linux

To print only the kernel version along with it’s major and minor versions:

# uname -r
2.6.18-164.11.1.el5

To print the system architecture type i.e. whether the machine is 32 or 64 bit, use:

# uname -p
i686

The /proc/version file also contains the kernel information:

# cat /proc/version
Linux version 2.6.18-164.11.1.el5 (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Wed Jan 20 07:39:04 EST 2010

Webmail login error: Your Internet Address has changed since the beginning of your Mail session.

Posted by admin     Category: cPanel Management, Plesk Management

Sometimes you see the following error at the middle of your Webmail Horde session :

Your Internet Address has changed since the beginning of your Mail session. 
To protect your security, you must login again.

This error mostly occurs when the ISP is using proxy servers to filter the browsers content. The proxy server randomly change its IP address and thus cause you to fail the web mail security measures.

The solution is to turn off the ‘checkip’ parameter in the Horde’s configuration file.  The configuration file is located as follows:

cPanel server : /usr/local/cpanel/base/horde/config/conf.php
Plesk server  : /usr/share/psa-horde/config/conf.php

Edit the respective configuration file depending on the control panel you have and look for

$conf['auth']['checkip'] = true;

replace it with

$conf['auth']['checkip'] = false;

This is it. Please note, this is a server wide change and cannot be done on user basis.

[Ubuntu] apt-get: Package has no installation candidate

Posted by admin     Category: Linux Administration

When you try to install a package using apt-get, APT searches it’s own database for the package name, if the package is available in the database, then it looks for the repository from where to download the package. It then download the package from that repository and installs it.

If the package name does not exist in APT’s database, it does not have any idea what you are trying to install and you see the following error message:

#  apt-get install <packagename>
Reading package lists... Done
Building dependency tree... Done
Package aptitude is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package <packagename> has no installation candidate

 

So, the above error occurs for 2 reasons:

1) The APT’s database is not updated.

A quick fix is to update the APT’s database as per the defined sources list.

# apt-get update
# apt-get upgrade
# apt-get install <packagename>

This is it. If isn’t fixed, check point #2 below.

2) The package itself isn’t available on the official Ubuntu repository.

In such a situation, you have to add a 3rd party repository to your /etc/apt/sources.list file and install the package, however, try such repositories at your own risk.