Aug 11, 2015

rsh Permission denied error fix?

RSH command execution is throwing permission denied error as shown below.


host1> /usr/bin/rsh -l user1 host2 "ls /user1"
Permission denied.

Reason: host2 machine user1 home directory missing .rhosts file

FIX: Connect host2 machine, goto user1 home directory and create .rhosts file.
Provide the file permission as 0600 to file .rhosts and try RSH command now.. :)



May 15, 2015

How to get the unused or free IPs on linux machine?

 Inline format of the script:
lsof -nl >/tmp/lsof.log;rm -rf ~/freeIPs.log; for ip in `ip add list|grep -v "127.0.0\|::1\|0.0.0.0\|00:00:"|cut -d" " -f6|cut -d"/" -f1|grep -v qdisc|awk 'NF'`;do grep $ip /tmp/lsof.log > /dev/null; if [ $? != 0 ]; then echo $ip >> ~/freeIPs.log; fi; done; rm -rf /tmp/lsof.log;echo "Total IPs:`ip add list|grep -v "127.0.0\|::1\|0.0.0.0\|00:00:"|cut -d" " -f6|cut -d"/" -f1|grep -v qdisc|awk 'NF'|wc -l`"; echo "Free IPs:`wc -l ~/freeIPs.log`";

Script:

 lsof -nl >/tmp/lsof.log
 rm -rf ~/freeIPs.log
 for ip in `ip add list|grep -v "127.0.0\|::1\|0.0.0.0\|00:00:"|cut -d" " -f6|cut -d"/" -f1|grep -v qdisc|awk 'NF'`
 do 
     grep $ip /tmp/lsof.log > /dev/null
     if [ $? != 0 ]
    then 
          echo $ip >> ~/freeIPs.log
    fi
 done
 rm -rf  /tmp/lsof.log
 echo "Total IPs:`ip add list|grep -v "127.0.0\|::1\|0.0.0.0\|00:00:"|cut -d" " -f6|cut -d"/" -f1|grep -v qdisc|awk 'NF'|wc -l`";
 echo "Free IPs:`wc   -l ~/freeIPs.log`";

Sep 5, 2014

Sample in-line unix "for" loop command eaxmples.

home>for i in {307,306,311} ; do echo $i; done
output:
307
306
311

home> for i in {307,306,311} {374..376} ; do echo $i; done
output:
307
306
311
374
375
376

May 5, 2014

How to setup password free SSH to hostname/localhost?


cd ~
echo "Removing the OLD .ssh dir"
rm -rf .ssh
ssh-keygen -t rsa
mkdir -p ~/.ssh
cat .ssh/id_rsa.pub >> .ssh/authorized_keys
chmod 700 .ssh; chmod 640 .ssh/authorized_keys
ssh-add
ssh `hostname`

May 1, 2014

Quotes

Before making the world to understand about some one, first you understand. -May1,2014

Don't make world to learn, first your learn.

Be strong when u know about the future. How ever it comes u can take it,
Or make your own way when you are strong.

Diamonds and stones look like same but they never. 

Gold is not available directly, it was extracted from soil after removal of impurities.

By default no one is perfect, thats why pencil needs an eraser to write prefect story/sentence.