Wednesday, June 26, 2013

ssh Error : Could not open a connection to your authentication agent

Could not open a connection to your authentication agent :

If you are trying to execute ssh-add -l or ssh-add and it gives following error.
 Could not open a connection to your authentication agent
To remove this error, Run following command.
# eval `ssh-agent`
Now try to tun ssh-add again.

Change hostname of your Linux machine without Reboot

Change hostname of your Linux machine without Reboot :

You must fill hostname while installation. It is your machine name.

If you want a definition of host-name or you want to understand what exactly is it, you should click here .

But if you know about it, you should read ahead.

You must have seen your host name in terminal after symbol '@'.
But if you want to know your host-name using command line, you should run
# hostname
If you want to change it, follow this.

If you are using CentOS, Fedora or Redhat

1) Open file /etc/sysconfig/network
2) Now change HOSTNAME=old-host-name to HOSTNAME=new-host-name
3) Save the file
4) Restart network using
# service network restart
Now open terminal, you will see the host name has been changed after symbol '@'
If you are not satisfied enough. Run command
# hostname

If you are using Debian or Ubuntu

1) Open file /etc/hostname
2) Change the old hostname into new hostname.
3) Save the file.
OR
Run the following command
# echo new-hostname > /etc/hostname
Now open terminal, you will see the host name has been changed after symbol '@'
If you are not satisfied enough. Run command
# hostname

Friday, June 14, 2013

Enable & Disable SELinux

Enable & Disable SELinux on CentOS :

Disable SELinux :
Run on terminal
# echo 0 > /selinux/enforce
or
# setenforce 0
No need to reboot using above commands but when system will reboot SELinux will be enabled again.

Enable SELinux :
# echo 1 > /selinux/enforce
or
# setenforce 1
No need to reboot using above commands.

Permanent Solution (Disable SELinux ):
Open file /etc/selinux/config
change SELINUX=enforcing to SELINUX=permissive 
or 
SELINUX=enforcing to SELINUX=disabled
Reboot the system.
It will disable the SELinux permanently.

Check status of SELinux
# getenforce
Output is :
Disabled

Another command :
# sestatus
Output is :
SELinux status:                 disabled