RSSAll Entries in the "SSH" Category

Can not include OpenSSL headers files.

Today I had question about “..why since I have OpenSSL installed and working fine with other services, I receive such message(the bellow one) when I am trying to compile something..”

The answer is because the application you are trying to compile manually requires “openssl-devel.x” package installed. It includes files for development of applications which will use OpenSSL.
So according to your OS you should use either yum, apt-get or gpg to install it.
In my example I am trying to compile on CentOS 32 bit, so I will use yum like that:

So the next time when I try to compile my application, Openssl headers files will be there:

Tags

How to disconnect (kick out) other SSH users

In this tutorial I will talk about how to disconnect SSH user from Linux remote server.

This is useful when you have stuck SSH connections or there are suspicious IPs connected to the server. If your case is the second one you may kick out the hacker from the server, but even disconnected he may have setup already backdoor or application that will return the connection to him. Anyway the first step will be to kill sshd processes serving other connection but yours.

First you will have to login to the Linux server via SSH – if you are not aware how just click on the link.

Once logged in list all current users on the server using ‘w’ command – simply type:

This will list all users on the Linux box like this:

List logged users Linux

As you can see there are several users currently logged in, and to discover which one is yours can be done comparing your IP address, what is currently doing as well as the time – for how long the users is on the server.If you are just logged in your time will be the current one on the server.

To list which user which TTY(pts) is using we have to use the Linux ‘ps’ command with extended output like this:

The output will show which “sshd” service running for which ‘pts‘ stands:

List sshd processesNow I want to kick off Linux user with pts / 4 marked on the image, and for that I will use Linux ‘kill’ command.

This will send kill signal to process 6702 which is the number for the “sshd” service with pts / 4 running on the server.
After you have executed this command try the ‘w’ command to see if the user is still logged in.

Tags

Install YUM on CentOS

Writing this tutorial was inspired by VPS (Virtual Private Server) running with CentOS Linux without installed YUM (Yellowdog Updater, Modified). Often I am wondering why that is? If the VPS is coming with Plesk control panel installation – it is obvious – Parralels do not include YUM in their packages, and all additional modules should be installed from the Plesk Updater in order to prevent system miss configuration.
What about if you just have VPS with Linux (in this example with CentOS) without automatic updater?
If you are new with Linux – just for your information – YUM is an automatic updater and package maintainer for rpm packages. It calculates dependencies automatically it makes it easier to maintain groups of machines without having to manually update each one using RPM.

Simply copy and paste these lines in your console. Take in mind you should have root or sudo privileges.

Note: Scroll down for YUM install on CentOS previous versions.

Install YUM on CentOS 5.7 64 bit.

Install YUM on CentOS 5.7 32 bit.

Install YUM on CentOS 5.6 64 bit.

Install YUM on CentOS 5.6 32 bit.

Install YUM on CentOS 5.5 64bit :

Install YUM on CentOS 5.5 32bit :

Install YUM on CentOS 5.4 64bit :

 

Here is another example of how to install it. This is a manual fetch of all the .rpm packages needed for YUM installation under CentOS 4:

 

This second method for YUM installation on Linux systems is including more work than the first one since you have to download all packages one by one, but if you have good repository for your Linux distribution it will simple to gather the needed RPM’s.

Certainly it is easier just to copy the first example and paste it in your console if you are with CentOS 5.4. This will automatically install it after few moments depending on your connection.

If you want to install YUM on different Linux distribution, or different CentOS version – to find what dependencies it needs just download ‘yum – X.X.X-X. centosX.noarch.rpm’ package and try to run:

 

The system will generate all the YUM dependencies and will list it for you. Then go trough the Linux repository and collect all the packages listed. Ones you are ready just use the second method (the example with CentOS 4) to fetch and install them.

Tags

Convert SSH private key with PuTTY keygen

This tutorial will show you how to convert SSH private key with Putty keygen.
It is silly, but SSH2 private keys do not have standard format. OpenSSH, ssh.com, PuTTY have different formats, and any key generated with one client cannot immediately be used with another.

For example in my tutorial create and use SSH key under linux we have discussed how to create key pair using ssh-keygen tool. My private key was looking like this:

Tags

Create and use SSH key

This tutorial will explain how to create ssh key which you can use to access your Linux /Unix server without entering password, or just because this is securest and more professional way to access any server.

I presume that you have certain knowledge with SSH and unix /linux commands, so I am going directly to the point were we are going to generate ssh key.

Access your server, login as your preferred user and start ‘ssh-keygen’.
There are a lot of options with which you can play, as encryption type, how many bits it will be ‘¦ etc.
In our case we will use the default one just to show you the method. Once you manage to create key pair and it works, you can always go back and create another one.

So, type ‘ssh-keygen’ in the command line and fallow the instructions.

How to disable the direct root login via SSH

This tutorial will show you how to disable the direct root login on a computer with Unix/Linux operating system.

To stop the direct root access you must edit the SSH configuration file located at ”/etc/ssh/sshd_config”

Open the file with your favorite editor, for example VIM, and locate the ”Authentication” section. There set PermitRootLogin to be ”no” as in the example bellow.

How to change the port of my SSH connection

This tutorial will show you how you can change the port of your SSH connection. This will help you to avoid automated brute-force attacks to your server. To make this change we are going to edit the settings in ‘sshd_config’ file.

Most of the attacks are made by bots, not from a real person and they are targeted to the default services ports. When you change SSH port, the service won’t be attacked by artificial scripts, as it takes to much time the whole ports range to be checked.

Connect to your server with SSH client . Switch to root and type: