Thursday, 25 September 2014

This tutorial explains how to install Skype in CentOS,
Redhat linux. CentOS and RHEL requires more dependencies during installation of
Skype and its difficult to install all the dependencies step by step manually.
So we need to setup a repo for Skype or we can install a repository which
contains Skype and its dependencies.

scp command is used to copy files from source host to
destination host. But we always need to enter a password on each time while
using scp command. rsync command is used to synchronize data between hosts. By
default rsync command uses ssh as well. Normally scp and rsync commands are
used to transfer or backup files between known hosts. During perform this task
we get prompting password every time which is really create hurdle.

You want to copy between two hosts src_hosts and dest_host.
src_host is the host where you will run the ssh, scp or rsync command.

This will prompt for a passphrase. You will only press the
enter key. It’ll then generate an identification (private key) and a public
key. Remember that don’t share the private key with anyone. ssh-keygen command
shows where it saved the public key. By default dest_host path is
~/.ssh/id_rsa.pub:

There are two ways to transfer public key (id_rsa.pub) file
from src_host to dest_host on path ~/.ssh/authorized_keys.

Now try logging into
the machine, with “ssh ‘dest_host.example.com'”, and check in:

.ssh/authorized_keys

to make sure we haven’t added extra keys that you weren’t
expecting.

If .ssh/authorized_keys file does not exists on dest_host,
then the above command will create it.

[root@dest_host .ssh]# ll

-rw-r–r– 1 root root
1213 Mar 5 07:05 authorized_keys

-rw——- 1 root root
1675 Jun 13 2013 id_rsa

-rw-r–r– 1 root root
404 Jun 13 2013 id_rsa.pub

-rw-r–r– 1 root root
5124 Jul 29 2013 known_hosts

-rw-r–r– 1 root root
404 Jun 13 2013 local.pub

Note that by default ssh command does not allow root to
login. We can allow root user to login by editing /etc/ssh/sshd_config and
changing the option of PermitRootLogin from no to yes. After change in
configuration file, we have to restart sshd to effect changes which we made.

Now we have done this, you can run ssh, scp and rsync on
src_host connecting to dest_host and it won’t ask for the password. Note that
this will still prompt for the password if you are running the commands on
dest_host connecting to src_host. You can reverse (vice versa) the steps above
(generate the public key on dest_host and copy it to src_host) and you have a
two way setup ready. Enjoy!

Sunday, 21 September 2014

By default, SELinux is enabled on some of Linux distibution,
due to this we face some issues which we don’t want to see any more. It is
recommended to know about SELinux, its configuration and how to implement on
your environment. However, you have to disable SELinux temporarily or
permanently until you understand about it.

Here, we will use different ways to disable SELinux.

In linux, files and process tag with specific labels that is
used by the SELinux. Command ls -Z view those labels as follows.

we will modify the /etc/selinux/config and change to
SELINUX=disabled to disable SELinux permanently. After reboot the machine,
settings will remain effective and permanent.

[root@amir ~]# cat /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing – SELinux security policy is enforced.
# permissive – SELinux prints warnings instead of
enforcing.
# disabled – No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted – Targeted processes are protected,
# mls – Multi Level Security protection.
SELINUXTYPE=targeted
SETLOCALDEFS=0

Disable SELinux from the Grub Bootloader

If you are unable to find out the location of
/etc/selinux/config file, you can disable SELinux to change parameter to the
Grub Bootloader in the following steps.

Telnet service is
to provide a text-oriented communications and this service is used on
internet/LAN using a virtual terminal connection. Telnet by default uses 23
port number. We will use telnet server installation and configurations on
CentOS 6 / Red Hat family as this service is also applicable and works to
fedora distribution environment.

IP Configuration (
My Server IP address is 172.16.41.82 )

Telnet Server Configuration

Open Terminal and
login as root user.

Install Telnet
server using yum.

[root@amir /]# yum install telnet*

Need to configure
telnet server, go to the directory /etc/xinetd.d to change configuration.

Using vim editor to
edit the telnet file.

[root@amir /]# vim telnet

Change option ‘disable = yes’ to ‘disable = no’.

# default: on

# description: The
telnet server serves telnet sessions; it uses \

# unencrypted username/password pairs for
authentication.

service telnet

{

flags = REUSE

socket_type = stream

wait = no

user = root

server = /usr/sbin/in.telnetd

log_on_failure
+= USERID

disable = no

}

Restart the service after change in the file and
permanently save the changes by using chkconfig option.

[root@amir xinetd.d]# service xinetd restart

Stopping xinetd: [
OK ]

Starting xinetd: [
OK ]

[root@amir xinetd.d]# chkconfig xinetd on

Check out the firewall settings for further
configuration. Enable the firewall settings and add telnet port 23 and Protocol
is tcp.

Thursday, 18 September 2014

If you forget your linux server or client machine root
password. Don’t you worry about this! in this tutorial i will explain with
steps how to recover linux root password and how you can reset it in simple
way.

However, there are couple of methods to recover root
password. So, lets go towards the easy and simple method I usually follow to
recover my root user password in linux whenever I forget the password.

Save and
close all your applications if you have opened already for safe data
before reboot the machine.

Monday, 15 September 2014

Step By Step Configuration of NAT
This tutorial shows how to set up network‐address‐translation (NAT) on a Linux system
with iptables rules so that the system can act as a gateway and provide internet access to
multiple hosts on a local network using a single public IP address. This is achieved by
rewriting the source and/or destination addresses of IP packets as they pass through the
NAT system.

Tuesday, 9 September 2014

In this tutorial
we will talk about how to show date and time in the terminal. By default, the
“prompt” or terminal displays the user name with which we are connected, the
machine name and the path where it is located. As follows:

So we see here
that the prompt is “<username> @ <machinename>: <path>”.

Note: When the
user is in his home, the path is replaced by a tild (“~”).

In this tutorial
we will see how to change the appearance of the prompt to display the time,
date, or other characters.

Procedure

We must first
understand that the form display prompt is specific to each user defined in the
environment variable “PS1″ initialized to start a session. We can check the
value of the environment variable “PS1″ with the following command:

[root@localhost
usr]# echo $PS1

Then we have the
following result:

We can therefore
understand that:

“\U”
= user

“@”:
The symbol at sign

“\H”
= the name of the machine

“\W”:
the current path

“$”
Sign dollars

Knowing this, we
can freely change the appearance of our prompt. This requires that the time and
date can be placed with the characters “\ t” for the time (“time”) and (“date”)
“\ d” for the date. We can change the value of “PS1″ to add these characters with
the following command:

[root@localhost
usr]# PS1=’\d\t\u@\h:\W$’

We will
immediately after a prompt like this:

You can of
course change the display order of elements at will.

Make the
Change Permanent

Since we have
only changed the environment variable, this change will only be temporary.
Indeed, restart another session, the environment variable will be reset. For
the change to be permanent for the user must add our line to change the PS1
variable in the initialization of bash file with the following command:

[root@localhost
usr]# echo “PS1=’\d\t\u@\h:\W$'” >> ~/.bashrc

Then restart a
session for verification. To make this change permanent same for all users, you
must make the same change on the common bash initialization file for all users: