Saturday, February 20, 2016

How to fix SSH Remote Host Identification Has Changed error


When trying to SSH to another machine and getting the following
message and the public key of the remote machine has changed since
your last login, you'll be presented with the following error;

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
..........
This is caused by the fact that SSH is by default configured to check
for the remote machine's host key every time a connection is to be
established.
You can fix the problem by whether disabling the key check, or have
the right key in your ~/.ssh/known_hosts file.
Disable key check

To do this temporarily when connecting to a remote server, add the
StrictHostKeyChecking no option when running your SSH command as in
the example below;

ssh -o 'StrictHostKeyChecking no' user@host

To make it permanent and system-wide, edit the SSH client
configuration file, and add the following line (if it doesn't already
exist)

StrictHostKeyChecking no


The file can normally be found at /etc/ssh/ssh_config
Update known-host file

~/.ssh/known_hosts is where the host keys are stored. A sample entry
of the file is as the following

192.168.0.111 ecdsa-sha2-nistp256
AAAAE2DjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBInXA+7gb/
gR0rOWlxzAvlt1SVEPamQBqRVbkDe7M4eZ3OC/yMXEA0QP8va62rGxvEx0quWf1FROQclYPc0NrT0=
example.com ecdsa-sha2-nistp256
AAAAE2VjZHNhLXNoaTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAACBBInXA+7gb/
gR0rOWlxzAvlt1SVEP1mQBqRVbkDe7M4eZ3OC/yMXEl0QP8va62rGxvEx0quWf1FROQclYPc0NrT0=
10.0.0.2 ssh-rsa
AAAAB3NzaC1yc2EAAAACAQABAAABAQCu9MUCkl0C7pXE//vtoRoxgVFGKOPWxvf1zA0HKYlHl5hR
/HL3TTZbmoqA/aet0VLAunetMOkQuSaLDCAJPQQ21DD5db6CMkjAtUkR/
xfGKiT8ZWBitBRE4cbBoPVhY9rjMtHlUFGy7pFYOSVau7rBxhsX9F9pIWDDuBEytjl3q5HAF+
qBOKrcdEcsMieCVhcEQRo2HkJ4r/8dR0Nxvtq05X3LAj8tFZJ34ClfA7iiALVRCHYxK8VyJHew1jxBJGbnZU/
vIndIcHjJO1TftfBOo7wDo1NeVD0UE7dYszu7mvY4tJKaPAgMGIAUScZ7c2BaLGk9gVLXkRzU+zQ6IpYf

You can use your favorite text editor to remove the offending line, or
you can also use the ssh-keygen program. The syntax for the ssh-keygen
program is as the following;

ssh-keygen -R hostname        (for example: ssh-keygen -R 192.168.1.23 )



How to Remove Old Kernels From Ubuntu and Debian


So below is the command line way:

1) Press Ctrl+Alt+T to open terminal for running commands. Check current running kernel version.

uname -r      OR

uname -sr

Don’t remove this kernel!


2) Copy and paste below command and hit run to check list of installed Kernels on your system:

dpkg --list | grep linux-image     OR

dpkg --list | grep linux-image | awk '{print$2}'


3) Find out the kernels you want to remove, and run below command to accomplish it:   Change x.x.x.x   to the kernel version

Notice :
Remember to keep the 2 latest kernels

sudo apt-get purge linux-image-x.x.x.x-generic


4) Update grub2 configuration

sudo update-grub2


5) Reboot the system

sudo reboot

How can I find which desktop environment I am using on a Linux machine?


To use the commands , go to the terminal and type:


echo $XDG_CURRENT_DESKTOP

or

ls /usr/bin/*session