Set it as the homepageBookmark this site

简体中文 繁體中文 English 日本語 Deutsch 한국 사람 بالعربية TÜRKÇE português คนไทย

 Retrieve your password
 Sign up now
img_loading
Intelligent detection

QQ login

Just one step, get started quickly

Search
Ad delivery contact QQ68610888Ad delivery contact QQ68610888
Landlord: DavidDengHui

[Other models of Xiaomi routers] BE3600 Pro Bundle Edition Toss (SSH+Static Route+AList+Docker)

 Fire.. [Copy link]
Published on 2025-6-18 11:11 | Show all floors
zh8416 Posted on 2025-5-12 11:42
According to the tutorial, the BE3600Pro main router in the mesh node state was turned on SSH and solidified, but it still failed after restarting.

The landlord's script is a bit problematic, I modified and optimized it myself, and the reboot worked under the BE3600 Pro test


auto_run.sh
  1. #!/bin/sh

  2. AUTO_RUN_DIR="/data/auto_run"
  3. LOADER_NAME="auto_run.sh"

  4. auto_run() {
  5.     # auto run script at startup.
  6.     echo -e "\033[32mSearching for scripts...\033[0m"
  7.     echo "Searching for scripts..." >> /tmp/log/auto_run.log
  8.     cd "$AUTO_RUN_DIR" || {
  9.         echo -e "\033[31mError: Cannot access $AUTO_RUN_DIR\033[0m" >&2
  10.         echo "Error: Cannot access $AUTO_RUN_DIR" >> /tmp/log/auto_run.log
  11.         return 1
  12.     }
  13.     for script in *.sh; do
  14.         [ "$script" = "$LOADER_NAME" ] && continue
  15.         echo -e "\033[33mExecuting: $script...\033[0m"
  16.         echo "Executing: $script..." >> /tmp/log/auto_run.log
  17.         if ! /bin/sh "$script"; then
  18.             echo -e "\033[31mError: Failed to execute $script\033[0m" >&2
  19.             echo "Error: Failed to execute $script" >> /tmp/log/auto_run.log
  20.         fi
  21.     done
  22.     echo -e "\033[32mAuto run scripts completed!\033[0m"
  23.     echo "Auto run scripts completed!" >> /tmp/log/auto_run.log
  24. }

  25. enable() {
  26.     # Add script to system autostart
  27.     uci set firewall.auto_run=include
  28.     uci set firewall.auto_run.type='script'
  29.     uci set firewall.auto_run.path="${AUTO_RUN_DIR}/${LOADER_NAME}"
  30.     uci set firewall.auto_run.enabled='1'
  31.     uci commit firewall
  32.     if ! iptables -L | grep -q "/* !fw3"; then
  33.         echo -e "\033[33mFirewall not started! Adding cron task...\033[0m"
  34.         grep -v "${LOADER_NAME}" /etc/crontabs/root > /etc/crontabs/root.new
  35.         echo "*/1 * * * * /bin/sh ${AUTO_RUN_DIR}/${LOADER_NAME} >/dev/null 2>&1" >> /etc/crontabs/root.new
  36.         mv /etc/crontabs/root.new /etc/crontabs/root
  37.         /etc/init.d/cron restart
  38.     fi
  39.     echo -e "\033[32mauto_run has been enabled!\033[0m"
  40. }
  41. disable() {
  42.     # Remove scripts from system autostart
  43.     uci delete firewall.auto_run
  44.     uci commit firewall
  45.     if grep -q "${LOADER_NAME}" /etc/crontabs/root; then
  46.         grep -v "${LOADER_NAME}" /etc/crontabs/root > /etc/crontabs/root.new
  47.         mv /etc/crontabs/root.new /etc/crontabs/root
  48.         /etc/init.d/cron restart
  49.     fi
  50.     echo -e "\033[33mauto_run has been disabled!\033[0m"
  51. }
  52. main() {
  53.     case $1 in
  54.         "")
  55.             if [ -e "/tmp/log/auto_run.log" ]; then
  56.                 exit 0
  57.             fi
  58.             auto_run
  59.             ;;
  60.         enable) enable ;;
  61.         disable) disable ;;
  62.         *) echo -e "\033[31mUnknown parameter: $1\033[0m"; return 1 ;;
  63.     esac
  64. }
  65. main "$@"
Copy the code


10_open_ssh.sh
  1. #!/bin/sh

  2. auto_ssh_dir="/data/auto_run"
  3. host_key="/etc/dropbear/dropbear_rsa_host_key"
  4. host_key_bk="${auto_ssh_dir}/dropbear_rsa_host_key"

  5. # Restore the host key.
  6. [ -f $host_key_bk ] && ln -sf $host_key_bk $host_key

  7. # Enable telnet, ssh, uart and boot_wait.
  8. [ "$(nvram get telnet_en)" = 0 ] && nvram set telnet_en=1 && nvram commit
  9. [ "$(nvram get ssh_en)" = 0 ] && nvram set ssh_en=1 && nvram commit
  10. [ "$(nvram get uart_en)" = 0 ] && nvram set uart_en=1 && nvram commit
  11. [ "$(nvram get boot_wait)" = "off" ] && nvram set boot_wait=on && nvram commit

  12. if ! grep -q 'channel="debug"' /etc/init.d/dropbear ; then
  13.     sed -i 's/channel=.*/channel="debug"/g' /etc/init.d/dropbear
  14. fi

  15. if [ -z "$(pidof dropbear)" ] || [ -z "$(netstat -ntul | grep :22)" ]; then
  16.     /etc/init.d/dropbear restart 2>/dev/null
  17.     /etc/init.d/dropbear enable
  18. fi

  19. # Host key is empty, restart dropbear to generate the host key.
  20. [ -s $host_key ] || /etc/init.d/dropbear restart 2>/dev/null

  21. # Backup the host key.
  22. if [ ! -s $host_key_bk ]; then
  23.     i=0
  24.     while [ $i -le 30 ]; do
  25.         if [ -s $host_key ]; then
  26.             cp -f $host_key $host_key_bk 2>/dev/null
  27.             break
  28.         fi
  29.         i=$((i + 1))
  30.         sleep 1s
  31.     done
  32. fi
Copy the code


Comments

The Internet is not a place of lawlessness, don't vent your dissatisfaction here, you must be sensible. : 5.0
The Internet is not a place of lawlessness, don't vent your dissatisfaction here, you must be sensible. : 5
The cow's cow is professional enough, this log is recorded in detail, good! It's good to catch insects!  Published on 2025-6-19 06:25
If the test is successful, not only will the SSH permission be automatically obtained at boot, but also lucky can be started by the way  detail Reply Posted on 2025-6-18 15:56
Thanks, I'll go home and try it in the evening  detail Reply Posted on 2025-6-18 15:18

Score

Number of participants 1Enshan coins +1 Collapse reason
zh8416 + 1 Mighty Eun Mountain! (Repeat 10,000 times below)

See all ratings

Only talk about technology, don't talk about politics! (Click for details) | Enshan Wireless Forum welcomes your visit, please respect each other, friendly exchanges, it is recommended to keep a normal mind to look at the comments of netizens, do not overreact.
Posted on 2025-6-18 15:18 | Show all floors
Rumianoesa Posted on 2025-6-18 11:11
The landlord's script is a bit problematic, I modified and optimized it myself, and the reboot worked under the BE3600 Pro test

Thanks, I'll go home and try it in the evening
Only talk about technology, don't talk about politics! (Click for details) | Enshan Wireless Forum welcomes your visit, please respect each other, friendly exchanges, it is recommended to keep a normal mind to look at the comments of netizens, do not overreact.
Posted on 2025-6-18 15:56 | Show all floors
Rumianoesa Posted on 2025-6-18 11:11
The landlord's script is a bit problematic, I modified and optimized it myself, and the reboot worked under the BE3600 Pro test

If the test is successful, not only will the SSH permission be automatically obtained at boot, but also lucky can be started by the way
Only talk about technology, don't talk about politics! (Click for details) | Enshan Wireless Forum welcomes your visit, please respect each other, friendly exchanges, it is recommended to keep a normal mind to look at the comments of netizens, do not overreact.
Posted on 2025-6-18 20:26 | Show all floors
Only talk about technology, don't talk about politics! (Click for details) | Enshan Wireless Forum welcomes your visit, please respect each other, friendly exchanges, it is recommended to keep a normal mind to look at the comments of netizens, do not overreact.
Posted on 2025-6-18 22:21 | Show all floors
11111111
Only talk about technology, don't talk about politics! (Click for details) | Enshan Wireless Forum welcomes your visit, please respect each other, friendly exchanges, it is recommended to keep a normal mind to look at the comments of netizens, do not overreact.
Published on 2025-6-19 02:30 From the phone | Show all floors
Thank you
Only talk about technology, don't talk about politics! (Click for details) | Enshan Wireless Forum welcomes your visit, please respect each other, friendly exchanges, it is recommended to keep a normal mind to look at the comments of netizens, do not overreact.
Published on 2025-6-19 18:24 From the phone | Show all floors
6666666
Only talk about technology, don't talk about politics! (Click for details) | Enshan Wireless Forum welcomes your visit, please respect each other, friendly exchanges, it is recommended to keep a normal mind to look at the comments of netizens, do not overreact.
Posted on 2025-6-20 16:17 | Show all floors
Does 1.0.87 still work
Only talk about technology, don't talk about politics! (Click for details) | Enshan Wireless Forum welcomes your visit, please respect each other, friendly exchanges, it is recommended to keep a normal mind to look at the comments of netizens, do not overreact.
Posted on 2025-6-20 23:22 | Show all floors
Try it
Only talk about technology, don't talk about politics! (Click for details) | Enshan Wireless Forum welcomes your visit, please respect each other, friendly exchanges, it is recommended to keep a normal mind to look at the comments of netizens, do not overreact.
Posted on 2025-6-21 08:54 | Show all floors
Thanks for sharing
Only talk about technology, don't talk about politics! (Click for details) | Enshan Wireless Forum welcomes your visit, please respect each other, friendly exchanges, it is recommended to keep a normal mind to look at the comments of netizens, do not overreact.
Published on 2025-6-21 08:55 From the phone | Show all floors
Thanks for sharing
Only talk about technology, don't talk about politics! (Click for details) | Enshan Wireless Forum welcomes your visit, please respect each other, friendly exchanges, it is recommended to keep a normal mind to look at the comments of netizens, do not overreact.
Posted on 2025-6-22 12:13 | Show all floors
Thank you for sharing
Only talk about technology, don't talk about politics! (Click for details) | Enshan Wireless Forum welcomes your visit, please respect each other, friendly exchanges, it is recommended to keep a normal mind to look at the comments of netizens, do not overreact.
Published on 2025-6-23 00:12 | Show all floors
day day study
Only talk about technology, don't talk about politics! (Click for details) | Enshan Wireless Forum welcomes your visit, please respect each other, friendly exchanges, it is recommended to keep a normal mind to look at the comments of netizens, do not overreact.
You'll need to be logged in to reply to posts login | Sign up now

This version of the points rules

Shut down

Welcome to the Enshan Wireless Forum

Only talk about technology, don't talk about politics! Don't spread rumors! For you and for others.
Only talk about technology, don't talk about politics! (Click for details) Remember not to spread rumors at will, just live your life in peace, for your own good and for the good of everyone. Enshan Wireless Forum welcomes your visit, please respect each other, friendly exchanges, it is recommended to keep a normal mind to look at the comments of netizens, do not overreact.

View »

If in doubt, add an administrator QQ86788181|Mobile version|Little dark house|Archiver|Enshan Wireless Forum (Changzhou Enshan Computer Development Co., Ltd. All rights reserved) ( Su ICP No. 05084872 )

GMT+8, 2025-6-23 21:50

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com

快速回复 返回顶部 返回列表