How to change the default SSH port

In this How-To article we’re going to walk you though changing the default SSH server listening port on a Linux system and security harden your host.

In this How-To article we’re going to walk you through changing the default SSH server listening port on a Linux system.

The Secure Shell (SSH) Protocol by default uses port 22. Accepting this value does not make your system insecure, nor will changing the port provide a significant variance in security. However, changing the default SSH server listening port will stop many automated attacks and a bit harder to guess which port SSH is accessible from. The attacker should execute a nmap like scan against your host to discover the port SSH service listens. So changing the default SSH port has no meaning on private networks, but maybe it’s useful and it’s a simple security hardening technique on public accessible hosts. Continue reading “How to change the default SSH port”

The Zen of Python by Tim Peters

If the implementation is hard to explain, it’s a bad idea.
If the implementation is easy to explain, it may be a good idea.

Today I found out what happens when I tried to import this in python:

# python
Python 2.7.10 (default, Oct 28 2015, 19:25:22)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.76)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import this
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
>>>


source: https://www.python.org/dev/peps/pep-0020/

My new raspberry pi 2 – Choosing the SD card

I think almost every tech savvy guy has listen some things for the raspberry pi. In case you don’t please take a moment to give it a look. It’s just a perfect starting point to create some great projects for your home. I ‘ve just bought my new raspberry pi 2. I am a great fun of raspberry pi, I already own two raspberry pis. I use one as my media center running OpenELEC and one as my home webserver to use some opensource projects like couchpotato over raspbian. It was time for me to get the “new” quad core model with 1Gb of RAM. What’s I am going to use it for? Home automation. My new raspberry pi is my ticket to the IoT trip I want to go. For the moment I am trying to find the best equipment to buy to keep my raspi’s (raspi is my favorite code name for raspberry pi) performance at the top level.

Storage for Operating System

Raspberry Pi uses an SD card to store the bootloader and the operating system to load. The older raspberry pi was using an SD card while the new one is using a  micro-SD card. From my previous experience of my first raspis I had some issues with some of the SD cards, not knowing a lot about their performance then. I got two Toshiba SD-C064GR7AR30 class 10 SD cards and I thought that I would have a great performance experience with them. That was not true. The class of the card is an index of its performance. The higher the class (highest is class 10) the quicker the card is. But we should keep in mind that SD cards are mainly used in digital cameras. For a camera the SD card is used to store the pictures we shoot. So the fastest the write (storing procedure of the picture) is the best for the camera’s performance in number of shootings per second. So the SD card fine tuned for this type of use.

Regarding the performance of an SD card used in the Raspberry Pi we should keep in mind that after the data is read a lot more frequently than written. The io tasks are made (written) in and (read) from differing locations on the card. This difference in the way Raspberry Pi uses the SD card, means that manufacturers rating may not be so accurate for this specific usage. So we need to get advice of this matrix of performance to select a best fit for our Raspberry Pi.

I am going to buy the Samsung PRO microSDHC 16GB UHS-I Class 10 card (Model number MB-MG16E) from a local store to check if it’s a good fit for my needs according to the matrix.

New digitalocean promo code September 2014 for new customers!!!

I ‘ll try to keep a section about digitalocean‘s promo codes for those that are interested in trying digitalocean’s spectacular performance.

A new digitalocean promo code is available for new customers for September 2014!

Go @ digitalocean website and sign up

To get your first Droplet going (Digital Ocean’s name for a VPS deployment) you have to enter your billing details as well as hand over your credit card. Digital Ocean actually offers per-hour billing for all their VPS offerings, so the credit card information is taken just to ensure they can bill you at the end of the month. By the way my choice of payment was through paypal! I added 10$ for the first two months.

Now after confirming your account you can add this promo code:

TWITTER914

and you will get 10$ free!!!

Go at digitalocean right now and use the above promo code, add 25$ more to your billing and you will have for almost a year a digitalocean vps and become a fan!!!

how to check if a perl module is allready installed

In this sort tutorial, I will present a simple and easy way to check if a module in perl is installed in your system.

All the work is done by using a simple command:

perl -MModule::Name -e "print \"Module installed.\\n\";"

so for example if I want to check if the Module Net::LDAP::Control::Persistent is installed I have to run this command

perl -MNet::LDAP::Control::PersistentSearch -e "print \"Module installed.\\n\";"

In case that this module is Installed the console will print

Module installed

In case that this module is not installed the console will print something like this:

Can't locate Net/LDAP/Control/PersistentSearch.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).
BEGIN failed--compilation aborted.

Change hostname permanently in CentOS 7

In this simple tutorial, I ‘ll show you how to change permanently the hostname of a CentOS.  With new version of CentOS many things have changed a lot form the previous version of the Operating System.

In CentOS 7 there is a tool named hostnamectl with which you can see information of your system and set permanently the hostname of your machine. Continue reading “Change hostname permanently in CentOS 7”

New digitalocean promo code August 2014 for new customers!!!

I ‘ll try to keep a section about digitalocean‘s promo codes for those that are interested in trying digitalocean’s spectacular performance.

A new digitalocean promo code is available for new customers for August 2014!

Go @ digitalocean website and sign up

To get your first Droplet going (Digital Ocean’s name for a VPS deployment) you have to enter your billing details as well as hand over your credit card. Digital Ocean actually offers per-hour billing for all their VPS offerings, so the credit card information is taken just to ensure they can bill you at the end of the month. By the way my choice of payment was through paypal! I added 10$ for the first two months.

Now after confirming your account you can add this promo code:

SHIPITFAST10

and you will get 10$ free!!!

Go at digitalocean right now and use the above promo code, add 25$ more to your billing and you will have for almost a year a digitalocean vps and become a fan!!!

Syslog: log all bash history from every user

There are sometimes I wish I had kept all of my history actions within the last 3 days, or I wish I could supervise what an other user have done to a system, I tried to find a way to log all ssh sessions to the server, logging them to syslog and keeping any action performed by every user! This is good for auditing some systems. Continue reading “Syslog: log all bash history from every user”

Auto check and repair the MyISAM tables

The last two days a table of the database which is used by my blog had a crashed MyISAM table, and this prevented my blog to be accessible.

The corresponding log of MySQL server:

[ERROR] /usr/libexec/mysqld: Table './webplay_db/prefix_options' is marked as crashed and should be repaired.

I have no monitoring tool set for my vps yet (it’s on my to do list 😛 , to set nagios) so I realised that my blog is not up when I tried to visit it. That’s  why a less time consuming action to solve this problem (than setting nagios) is to add a script in the crontab,  to check and repair tables . An every hour check is  good enough for this purpose:

/usr/bin/mysqlcheck --all-databases -uroot -ppassword -r

I hope a MyISAM table crash not being the reason for my blog's downtime anymore!