Webhosting Blog

Uncategorized

Configuring NTP synchronization in SUSE Linux Using YAST


To configure a SUSE server with NTP you can follow following steps:

We will use the Yast tool to configure the NTP on the SUSE server.

Issue the Command as follows to initiate the yast tool.

#yast

You can find basic yast configuration screen as follows. Navigate to Network Services and select NTP configuration.

YastConfig

This will open the basic NTP configuration screen.

BasicSettings

To configure the server with the basic NTP time synchronization while bootup of the servers select the option During Boot . In the NTP Server configuration section you can use the Random timeservers  Servers  or you can configure the required NTP server to be configured with the server in the Address section.

You can configure Advanced Settings for the NTP server via the Advanced Configuration setting.

It will open a screen similar to the following:

ADVSettings

Select the Edit option and place the appropriate Server details in the Address section. Once Done Click on Finish. It will auto restart all the respective services for NTP. Quit the Yast tool once all the above settings are done as mentioned.

You can check the configuration using the ntpq command.

#ntpq -p

Or

# ntpq

ntpq> peers

This will print a list of the peers known to the server. Thats it! The server is now synchronized with the mentioned NTP server.

Advertisements

2012 in review


The WordPress.com stats helper monkeys prepared a 2012 annual report for this blog.

Here’s an excerpt:

4,329 films were submitted to the 2012 Cannes Film Festival. This blog had 44,000 views in 2012. If each view were a film, this blog would power 10 Film Festivals

Click here to see the complete report.


Modsecurity cron problem.


Sometimes you might start receiving the errors in mod security cron as follows:

DBI
connect(‘modsec:localhost’,’modsec’,…) failed: Access denied for user href=”mhtml:{CA6DED19-950C-4C5A-97F2-5C8634CBD55B}mid://00000086/!x-usc:mailto:’modsec’@’localhost'”>’modsec’@’localhost’
(using password: YES) at /etc/cron.hourly/modsecparse.pl line 19
Unable to connect to mysql database at /etc/cron.hourly/modsecparse.pl line 19.

The error occurs due to the password being mis configured in the file /etc/cron.hourly/modsecparse.pl .

You can use the following steps to sort the issue.

1) open the file /etc/cron.hourly/modsecparse.pl. You can find the following details in the file :

my $dbhost     = ‘localhost’;
my $dbuser     = ‘modsec’;
my $dbpassword = ‘somepassword’;      
my $dbname     = ‘modsec’;
my $tblname    = ‘modsec’;

check the password in the actual database for modsec.

server@root# mysql
mysql >\u mysql
mysql> select password from user where user=’modsec’;
mysql> select password(‘dbpassword’);

ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect…
Connection id:    4797
Current database: mysql

+——————————————-+
| password               |
+——————————————-+
| *8810994AD1910DDF9B31CB0DBF699C984CCFFEDC |
+——————————————-+
1 row in set (0.00 sec)

Replace the dbpassword with actual password from the file /etc/cron.hourly/modsecparse.pl .

mysql> UPDATE user SET Password=PASSWORD(‘somepassword’) WHERE User=’modsec’;

This will reset the password for the DB modsec to the original password  somepassword in the file /etc/cron.hourly/modsecparse.pl .

Once done you can just run the following command to ensure the DB is fixed !

server@root # perl -w /etc/cron.hourly/modsecparse.pl

If it runs without error the problem is sorted. :)

 

 


Redirect all http URL’s to https for the domain.


Add following code to the .htaccess file under your document root folder for the domain:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

This will help you to redirect all the http URL’s in the domain to https.


How to Zip a folder in linux?


You can zip a file easily in linux, but creating a zip of a folder is a bit tedious task. Following is a simple command to create a zip for a folder in linux.

[root@server~]# zip  -r  zipfile.zip  foldername

You can add the option -9 to the command for best compression.


How to Restart Ruby on Rails from shell for a particular account


Following are the steps to restart ROR for a particular domain

root@server[#] cd /home/username

root@server[#] cd rails_apps

root@server[#] cd demo (Application name)

root@server[#] mongrel_rails mongrel::restart

Thats it!


SFTP : No supported authentication methods available


While accessing FTP with SFTP you might face following error

No supported authentication methods available.

Try to work with normal FTP and it might work fine but SFTP will not.

For this just check the file /var/log/secure on the server. You can find error message as

Mar 31 10:33:25 server sshd[15388]: Received disconnect from XX.XX.XX.XX: 14: No supported authentication methods available

The problem is faced due to PasswordAuthentication setting in /etc/ssh/sshd_config.

If the setting PasswordAuthentication is disabled in the SSH configuration file SFTP will not function. For this you can set PasswordAuthentication to on.

PasswordAuthentication on

Once you edit the file save and restart the sshd service using the command

root@server [~]# /etc/init.d/sshd restart

Now try to login the SFTP. It should sort your issue.