1. 服务器ssh没法登陆排查顺序

2. 反解IP(resolve ip address)的脚本和方法

3. tr的妙用

 

1. 服务器ssh没法登陆排查顺序

  a. 本地ping 服务器查(看***的链接情况)
  b. 查看属组
  c. home目录权限777
  d. 查看查看公钥 auth.log
  e. 查看/var/log/auth.log

 

2. 反解IP(resolve ip address)的脚本和方法

a. 法一

#!/bin/bash
for LINE in `cat ip.txt`
do
#  echo "Got [$LINE]"
  host $LINE
done

b. 法二
cat ip.txt |xargs -I{} host {}
cat ip.txt |xargs -I{} host {} |awk {'print $1,$5'}

 

3. tr的妙用

a.

for i in {8..31};do echo 0 $i;done|tr '\n' ' '

0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31

b.

echo "0 8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31"|tr ',' ' '

 

c. 0 8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31  | sed 's/,/ 0 /g'