简体   繁体   English

嵌入式te.net登录管理 linux

[英]Login and management over telnet in embedded linux

We are moving over from C on AVR to an embedded Linux platform.我们正在从 AVR 上的 C 转移到嵌入式 Linux 平台。

Appreciate some 'best practice' suggestions on how we should program (eg bash scripting/c program) a te.net 'management console' to first login to the device (we now have a working kernel and able to run simple 'hello world' c program) and then allow user to enter commands like 'set msc', where the console will prompt for apn?欣赏一些关于我们应该如何编程(例如 bash 脚本/c 程序)te.net“管理控制台”以首次登录设备的“最佳实践”建议(我们现在有一个工作 kernel 并且能够运行简单的“hello world” c 程序),然后允许用户输入诸如“set msc”之类的命令,控制台将在其中提示输入 apn? username?用户名? password... etc.密码...等等

Do we just write a c program as a 'te.net server' and have it running waiting for a te.net client connection over a socket?我们是否只编写一个 c 程序作为“te.net 服务器”并让它运行以等待 te.net 客户端通过套接字连接? Or are there other approach in embedded Linux?或者在嵌入式 Linux 中还有其他方法吗? Thank you.谢谢你。

Best practice would probably be to use an existing solution.最佳做法可能是使用现有解决方案。 For instance, we use openssh for our embedded boards (ARM and x86 platforms), together with a serial console for debug.例如,我们将openssh用于我们的嵌入式板(ARM 和 x86 平台),以及用于调试的串行控制台。 Both of these will give you both login-handling and all that for free.这两个都将免费为您提供登录处理和所有这些。

To add, our kernel and rootfs are created with PTXdist , so we can easily add, handle and cross-compile new applications and packages from a standard host computer.另外,我们的 kernel 和 rootfs 是使用PTXdist创建的,因此我们可以从标准主机轻松添加、处理和交叉编译新的应用程序和包。 It works just fine, and also makes it very easy to actually port complete applications to other platforms.它工作得很好,而且也使得将完整的应用程序实际移植到其他平台变得非常容易。

First of all, I would recommend using dropbear (lightweight sshd ) on the target so that communications with the device are encrypted, only include te.netd if you must.首先,我建议在目标上使用dropbear (轻量级sshd ),以便加密与设备的通信,如果必须,只包括te.netd

No matter which way (or both) you choose, you need to setup some scripts to start dropbear/te.netd.无论选择哪种方式(或两种方式),都需要设置一些脚本来启动 dropbear/te.netd。 This will wary depending on your distribution.这将取决于您的分布。

Then setup an account on the device that will be used to administer the system and make that users shell be your custom CLI.然后在将用于管理系统的设备上设置一个帐户,并使该用户 shell 成为您的自定义 CLI。 (This info is stored in /etc/passwd) (此信息存储在 /etc/passwd 中)

The CLI can then be implemented in whatever language seems appropriate, it will just read/write stdin/stdout which will be connected to either a te.net or ssh client on the user side.然后可以用任何看起来合适的语言来实现 CLI,它只会读/写 stdin/stdout,它将连接到用户端的 te.net 或 ssh 客户端。 All te.net logic is handled by te.netd which will in turn call login to manage authentication of the user.所有 te.net 逻辑都由te.netd处理,后者将依次调用login来管理用户的身份验证。 Both of these applications are available with busybox which will most likely be a part of your root filesystem.这两个应用程序都可以通过busybox使用,它很可能是根文件系统的一部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM