Openwrt default boot ssh method

Source: Internet
Author: User
Tags ssh access dropbear
Openwrt default boot ssh method current situation: Openwrt cannot be directly connected using ssh after boot, you need to configure on the page before connecting, system-& gt; administration-& gt; SSHAccess is actually used to modify the interface as needed. Save the password (the password cannot be blank... openwrt default boot ssh method

Current situation:
Openwrt cannot be directly connected by using ssh after it is started. it must be configured on the page before it can be connected. system> administration> SSH Access is actually the interface you need to modify, change the password (the password cannot be blank) and save the application.

Note: By default, telnet is enabled for openwrt but ssh is not enabled. after the user name and password are configured, ssh is enabled by default and telnet is disabled. In this case, the system prompts "Login failed ."





Solution process:

You can modify the dropbear configuration file in two steps:
You do not know what configuration files have been modified, so you need to start searching from the luci page. Run the grep command.

In/usr/lib/lua/luci/model/cbi/admin_system/admin. lua
As you can see, the modified configuration file is the/etc/config/dropbear file.



After configuration
# Vim/etc/config/dropbear


No interface configured before configuration (default)
# Vim/etc/config/dropbear


Now we can confirm the configuration file. now we need to modify the file in the openwrt compiling environment so that the firmware compiled by openwrt can directly meet our requirements.
Path in Openwrt: package/network/services/dropbear/files/dropbear. config [plain]

[Openwrt @ root files] $ vim dropbear. config
1 config dropbear
2 option PasswordAuth 'on'
3 option RootPasswordAuth 'on'
4 option Port '22'
5 option Interface 'lan'
6 # option BannerFile '/etc/banner'
Change to the above

Step 2: modify the root password
Because openwrt does not have a password by default, ssh cannot be connected and only telnet can be connected. we only need to configure the password when openwrt is enabled!

There are two methods to enable openwrt to start up:
1. it is feasible to modify the original shadow file --------
2. run the echo "password" command when starting a command | passwd root-stdin --- this method is supported in general linux, but passwd in busybox is not supported, the following error occurs:


Then, modify the/package/base-files/etc/shadow file and paste the encrypted root password into the file. when the password is 123456, the encrypted password should be: [plain]

Root: $1 $ BTkC8R/1 $ ZtNrYbhknXmNKGHDJCmJc1: 15783: 0: 99999: 7 :::
Paste this line into the shadow file. after openwrt is started, the default password is 123456. telnet is unavailable, and ssh is enabled by default.

Finally delete the/staging_dir/target-i386_uClibc-0.9.33.2/root-x86 folder (I'm trying to compile iso so it's x86 architecture). The Directory names for other architectures are different.
Recompile it.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.