Tuesday, November 27, 2012

Clear the memory cache.

Clear the memory cache.
======================

# sync; echo 3 > /proc/sys/vm/drop_caches

Hardware clock set

# hwclock --show
$ date

Set clock

To set the system clock directly:

# date MMDDhhmmYYYY



Hardware Clock Set
====================
To set the hardware clock directly (the argument must be in local time, even if you keep your hardware clock in UTC.):

# hwclock --set --date="YYYY-MM-DD hh:mm:ss"

# hwclock --set --date=hh:mm:ss"


or

Synch time to hardware to OS / OS to hardware

The hardware clock can be set from the system clock and vice versa:

# hwclock --systohc
# hwclock --hctosys

Create a local compressed tarball from remote system directory

Create a local compressed tarball from remote host directory


# ssh user@host "tar -cf - /path/to/dir" | gzip > dir.tar.gz

Public Key issue while installing rpm through yum


Public Key issue while installing rpm through yum.

============================================

1. Check keys.
  
    find / -name "*GPG*"

  - Will get answers like below

    /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
    /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-former
    /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-rhx
    /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-auxiliary
    /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta


2. Go to the /etc/pki/rpm-gpg/
    # cd /etc/pki/rpm-gpg/

3. type the below command.
   # rpm --import *GPG*

 The above command wont be give any kind of output.

Adding SWAP by dd command

Create and add swap space in linux.
===========================

#dd if=/dev/zero of=/swap1 bs=1024 count=1048576

#dd if=/dev/zero of=/dev/swap1 bs=1G count=4

#mkswap /swap1

#swapon /swap1

#free -m


bs=1024 ( 1MB )
count=1048576 ( 1GB )

Adding proxy in Linux

Adding proxy in Linux
===================

Run the below commands  in terminal to get proxy details for temporary.

export http_proxy=http://proxy-ip:port/
export https_proxy=https://proxy-ip:port/

export http_proxy=http://proxy-url:port/
export https_proxy=https://proxy-url:port/


Add the proxy details in /etc/profile to permanent changes and access to all users (global set),
or else add in user .bach_profile file to get effect on selected user.


---------------------------------------------

For FTP

$export ftp_proxy=http://<proxy-server-ip>:<port>

with auth
$export ftp_proxy=http://<user>:<password>@<proxy-server-ip>:<port>

------------------------------------------

For svn

#vi /etc/subversion/servers


[global]
#http-proxy-host=my.proxy
#http-proxy-port=80
#http-proxy-username=[username]
#http-proxy-password=[password]

Friday, October 12, 2012

Remote ssh login issue

If you have reinstalled Linux or UNIX with OpenSSH, you will get the bellow

error. (or else changes in hostname and ip address)
=======
Error
=======

[root@TESTBED ]# ssh root@192.168.x.x
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
8c:32:d8:2c:94:18:4f:7f:7f:2a:15:60:4d:6f:50:79.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:3
RSA host key for 192.168.x.x has changed and you have requested strict

checking.
Host key verification failed.
lost connection
[root@TESTBED ]#

=====================================

Solution :
Add the remote machine as known host as below.
to known host


[root@TESTBED ]# ssh-keygen -R 192.168.x.x
/root/.ssh/known_hosts updated.
Original contents retained as /root/.ssh/known_hosts.old
[root@TESTBED ]#