Data transmission and remote command execution in an openwrt Environment Based on ssh and password-free

Source: Internet
Author: User
Tags scp command ssh server dropbear

Data transmission and remote command execution in an openwrt Environment Based on ssh and password-free

This name is a bit too much X.

In fact, the problem is very simple. In general, openwrt runs on some embedded platforms or routers, and such platforms often do not have much resources, such as hard disk storage. However, some data, such as traffic, can only be captured and temporarily stored on it. Over time, if you do not copy the data back and delete it from openwrt, there will be insufficient space. Of course, in this process, it is inevitable to use some scripts and some commands, so how to remotely execute the commands.

First, the openwrt I use is in the BARRIER BREAKER version, and other versions are not tested.
Back to the problem, how can we solve it. Of course, one method is nfs, but the final failure stops at this problem:

mount.nfs: No such device

The problem with this post is basically the same, http://www.openwrt.org.cn/bbs/thread-509-1-1.html,cat/proc/filesystems also did not find nfs support, I think my system was actually cloned by someone else's vmdk, it may be that the nfs module is not added during kernel compilation. In any case, this method still gives up!

Then, we go to the second method and use scp to remotely copy back.

We need to execute the scp command in the script. The biggest problem is what to do with the password. Fortunately, there are password-free copy and logon for scp and ssh. You can refer to the following articles:

http://it.oyksoft.com/post/1836/http://www.thegeekstuff.com/2008/06/perform-ssh-and-scp-without-entering-password-on-openssh/http://www.360doc.com/content/13/1013/21/3884271_321222563.shtmlhttp://blog.csdn.net/shangzhiliang_2008/article/details/8602756

In this process, I made some detours and wrote them here to make a note, so as not to see people continue to make detours.

A lot of documents are the same as the first article above. But after a long time, you found that it was still not feasible. So at this time, you went to google for help and found the second article, suddenly realized that Nima had to require the ssh service to be on the openssh side, which is quite obvious. We provide dropbear on openwrt. What should we do? Should we change the ssh server?

Of course the answer is no, no, no .... at this time, we can search openwrt scp. Then you finally get the third article. This document is very short, but it is enough to tell us how to set it in dropbear. All right, that's all. Then, before scp, you need to know which files are on openwrt. At this time, you will use the fourth article, you can use scripts to conveniently monitor and copy data.

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.