Chinaunix首页 | 论坛 | 博客
  • 博客访问: 217541
  • 博文数量: 49
  • 博客积分: 2101
  • 博客等级: 大尉
  • 技术积分: 525
  • 用 户 组: 普通用户
  • 注册时间: 2010-09-07 10:38
文章分类

全部博文(49)

文章存档

2010年(49)

我的朋友

分类: 嵌入式

2010-09-07 15:44:48

1 基于busyboxtelnetd

       Busybox集成了telnetd功能,有两种选择:第一,使用inetd管理telnetd的启动,当有telnet连接时由inetd启动;第二,直接打开telnetd守护进程,监听telnet连接。本文选择的是直接打开telnetd守护进程,那么在编译busybox时必须做如下选择。

[*] telnetd  

[*]   Support standalone telnetd (not inetd only)

2 内核对telnetd的支持

       telnet是一种非常老的远程登录技术,linux内核配置时默认并不支持。要想内核支持telnet,必须选择两项功能。

       1Unix 98 PTY

2dev/pts file system for Unix98 PTYs

       根据对linux2.6.20内核配置的经验,只要选择了第一项功能,那么第二项功能就会自动被选中。因此在内核配置项中,找不到第二项。

Device Drivers  --->

Character devices  ---> 

    [*] Unix98 PTY support

       在系统运行是,通过cat /proc/filesystems命令可以看到devpts文件系统是否被支持。

3 根文件系统相关修改

3.1 挂载devpts文件系统

       首先应该确保在根文件系统目录下存在/dev/pts目录;其次,在/etc/fstab文件中添加如下挂载语句。

devpts             /dev/pts                devpts  gid=5,mode=620  0 0

       这样在系统启动后,会根据fstab文件挂载devpts文件系统的目录。

       或者,可以选择系统启动后手动挂载。

mount -t devpts devpts /dev/pts

 

3.2 添加/devptmx文件

       首先看这样一段话,说明了ptmx文件的作用。

A pseudo terminal (PTY) is a software device consisting of two

 halves: a master and a slave. The slave device behaves identical to

 a physical terminal; the master device is used by a process to

 read data from and write data to the slave, thereby emulating a

 terminal. Typical programs for the master side are telnet servers

 and xterms.

 Linux has traditionally used the BSD-like names /dev/ptyxx for

 masters and /dev/ttyxx for slaves of pseudo terminals. This scheme

 has a number of problems. The GNU C library glibc 2.1 and later,

 however, supports the Unix98 naming standard: in order to acquire a

 pseudo terminal, a process opens /dev/ptmx; the number of the pseudo

 terminal is then made available to the process and the pseudo

 terminal slave can be accessed as /dev/pts/. What was

     traditionally /dev/ttyp2 will then be /dev/pts/2, for example.

       其次,应该在/dev下建立ptmx设备节点。

mknod -m 666 ptmx c 5 2

 

4 运行telnetd

/sbin/telnetd -l /sbin/vt100

 

阅读(5389) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~