Posts in Category: Linux

Configure Windows clock to work better with OS X or Linux

All computers have an internal clock on the motherboard. The clock is very simple and has no support for time zones.

Windows assumes that it's the local time. If it's 12:30, it assumes that it's 12:30 in your time zone.

The rest of the operating systems instead assumes that the time is in Coordinated Universal Time, which is definitely a much better choice: knowing that this is a standard, is a breeze to change time zone or daylight saving time change.

For example, if you have two Windows on the same computer, both have no way of knowing whether the DST is set, then would both change the time for DST, causing endless problems. However, if the base is UTC time, there is no way to be wrong; = UTC +2 Daylight Saving Time, Standard Time = UTC +1

So, we set Windows to use UTC as the time base:

We can create a new text file with Notepad and write this text:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
“RealTimeIsUniversal”=dword:00000001

after saving, change the file extension to. reg and run it. That's it!

Or you can use Regedit and go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation and create a new 32 bit DWORD entry called RealTimeIsUniversal and set it to 1

Otherwise, you can download the REG file that I created for you

How to change the SSH port

When I set up my server, I decided to keep the SSH port at its default value for those three reasons:

  1. Worried to make the configuration file corrupted and not being able to log in anymore.
  2. Worried about some incompatibilities with some SSH software.
  3. With a port scanner it's trivial to find the new SSH

Of course I didn't leave the server in the wild with default settings:

  1. Access via preshared key with a long passphrase
  2. Configured Shorewall to slow down access to the port 22 (at most 1 request per minute)
  3. Set fail2ban to block access for 24 hours to who inputted the wrong password for more than three times
  4. Set fail2ban to send me an email in case of hacking

Recently, there was an attack from Korea with hundreds of logins.

Initially I decided to ignore the matter, then I said "Hey, changing the ssh port it's trivial!", so here is how to do that on Debian/Ubuntu:

nano /etc/ssh/sshd_config

Then change the port here:

# What ports, IPs and protocols we listen for
Port 2200

Then, restart the SSH daemon

/etc/init.d/ssh restart

Voila!

Concrete5 does not work with mod_pagespeed

I have a website using the concrete5 CMS, and I discovered that it does not work with Google's mod_pagespeed for Apache.

After installing it, it's not possible to add new pages, you'll get an error 404.

To disable it only for concrete5 websites, just write this in the .htaccess file:

<IfModule pagespeed_module>
ModPagespeed off
</IfModule>

In my opinion, the problem it's in the trim_urls filter, so you could just try to disable that.

Forward ports in VMware Server

Fortuitously, today I found a note that some years ago I marked as "critical", so here I am to share it with those who might need it one day

When nearly four years ago I moved Serverland from a virtual server to a real one, I thought that it was a good idea to continue to be virtualized, so I installed VMWare Server (it's free!).

Then, the shockingly low performance in accessing the virtual disks, led me to uninstall it, but at the time I had a problem: in the Windows version of VMware Server, there is a convenient panel for configuring the virtual network, but in linux version is absent ... what we can do?

The answer is here: http://www.howforge.com/port-forward-in-vmware-server-for-linux

How to delete files older than X days on linux

Sometimes can happen that you want to keep only the files of the last X days in a directory.

On Linux you can do that with a single command line:

find /path/where-are-the/files* -mtime +7 -exec rm {} \;

How it works:

-mtime indicates the days to keep. In the example, having written +7, we only keep files from the last week.

-exec indicates the command to execute in the event that a match is found (ie: the files older than a week), and in this case we pass rm, which eliminates them