openwrt配置多个sshd

openwrt配置多个sshd

目的1

让dropbear监听在wan口上

修改 /etc/config/dropbear

  1. config dropbear 
  2. option PasswordAuth 'on' 
  3. option RootPasswordAuth 'on' 
  4. option Port '22' 
  5. # option BannerFile '/etc/banner' 
  6. option Interface 'lan1' 
  7.  
  8. config dropbear 
  9. option PasswordAuth 'on' 
  10. option RootPasswordAuth 'on' 
  11. option Port '2202' 
  12. # option BannerFile '/etc/banner' 
  13. option Interface 'wan' 

修复启动时序问题

  1. admin@A820:~# cat /etc/hotplug.d/iface/50-dropbear  
  2. #!/bin/sh 
  3.  
  4. if [ "$INTERFACE" = "wan" ] && [ "$ACTION" = "ifup" -o "$ACTION" == "ifupdate"
  5. then 
  6. /etc/init.d/dropbear restart 
  7. fi 

关闭firewall

  1. $ /etc/init.d/firewall stop 
  2. # /etc/init.d/firewall disable 

目的2

免密码登陆AP

客户端Linux PC上

产生公共密钥,并复制到AP上

  1. $ ssh-keygen -t dsa 
  2. $ scp ~/.ssh/id_dsa.pub root@192.168.1.1:/tmp 

服务器端AP上

加入复制过来的密钥到authorized_keys

  1. $ cd /etc/dropbear 
  2. $ cat /tmp/id_dsa.pub >> authorized_keys 
  3. $ chmod 0600 authorized_keys 

nicephil@gmail.com

posted on 2017-03-01 17:01  nicephil  阅读(1314)  评论(0编辑  收藏  举报

导航