Annotation of wikisrc/tutorials/how_to_use_ptyfs.mdwn, revision 1.2
1.2 ! schmonz 1: **Contents**
! 3: [[!toc]]
! 5: # What is ptyfs ?
! 7: ptyfs is a pseudo-terminal device file system written by Christos Zoulas. It first appeared in NetBSD 3.0.
! 9: # How does it work ?
! 11: The traditional bsd style pty's are allocated to a fixed number of pty devices available. That is normally ttyp0 - ttyp9 and ttypa - ttypf which makes 16 ptys in total. There are also the groups of ttyq*, ttyr*, ttys* in the same way, which makes a total of 16 * 4 = 64 devices. This means, that no more than 64 remote connections to a NetBSD machine are possible.
! 13: ptyfs on the contrary is allocating the devices dynamically. That means, whenever a remote connection is established, a new device is created. This way the number of connections are only limited by the resources of the server.
! 15: # Why do I need it ?
! 17: Normally you don't. You will need ptyfs, if you're going to run a server with hundreds (> 64) of remote connections (ssh or telnet). There are also a few applications like Matlab, that require ptyfs. I personally prefer ptyfs and use it on all my servers.
! 19: # How do I use it ?
! 21: If you use NetBSD 4.0 or higher, ptyfs is enabled by default in all GENERIC Kernels. Otherwise, you have to rebuild your Kernel to use PTYFS. To enable PTYFS please ensure that the line
! 23: file-system PTYFS
! 26: is uncommented, or available in your Kernel config file. Now, rebuild your Kernel and reboot.
! 28: # Setting up /dev/pts
! 30: Change into the `/dev` directory and create the directory pts as root.
! 32: # cd /dev
! 33: # mkdir pts
! 36: # Testing ptyfs
! 38: Before we change the file `/etc/fstab`, we have to ensure, that ptyfs is working. Otherwise your server won't be able to boot. To test if ptyfs is working, mount it manually.
! 40: # mount_ptyfs ptyfs /dev/pts
! 43: Check, if it is mounted:
! 45: # mount
! 46: # ptyfs on /dev/pts type ptyfs (local)
! 49: # Editing fstab
! 51: You can now edit your `/etc/fstab` to mount it automatically everytime you boot. Please add exactly this line to your `/etc/fstab`:
! 53: ptyfs /dev/pts ptyfs rw 0 0
! 56: # Remote connections
! 58: New incoming remote connections are now acquired dynamically. You will notice that the new connections are called pts/* instead of ttyp*
! 60: # w
! 61: 11:34PM up 1:28, 2 users, load averages: 0.12, 0.10, 0.08
! 62: USER TTY FROM LOGIN@ IDLE WHAT
! 63: root console - 10:07PM 0 csh
! 64: john pts/0 princeton.preston.edu 11:34PM 0 w
! 67: You're done. Have fun.
! 69: # See also
! 71: * [mount_ptyfs(8)](http://netbsd.gw.com/cgi-bin/man-cgi?mount_ptyfs+8+NetBSD-current)
! 73: : http://netbsd.gw.com/cgi-bin/man-cgi?mount_ptyfs+8+NetBSD-current (http://netbsd.gw.com/cgi-bin/man-cgi?mount_ptyfs+8+NetBSD-current)
! 75: # View source code (Please report any bugs or suggestions [here](http://www.netbsd.org/cgi-bin/sendpr.cgi?gndb=netbsd)).
! 77: * [mount_ptyfs.c](http://cvsweb.de.netbsd.org/cgi-bin/cvsweb.cgi/src/sbin/mount_ptyfs/mount_ptyfs.c?rev=HEAD)
CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb