Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

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`";