home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1621 / INSTALL < prev    next >
Text File  |  1990-12-28  |  25KB  |  622 lines

  1. #!/bin/sh
  2. # This is a shell script. Feed it to sh.
  3. echo '
  4. Hi, and welcome to the pty install script.
  5. pty is a program for managing pseudo-terminals.
  6.  
  7. I'\''m not actually going to install anything.
  8. I'\''ll just guide you through what has to be done,
  9. from compiling through installation.
  10.  
  11. One advantage of this hands-off philosophy is that
  12. you can kill and restart this script at any time.
  13.  
  14. In the first part of this script, I'\''ll lead you through configuration.
  15. For the moment, don'\''t actually change anything in your system. Just
  16. alternate between reading this script and fooling around with the
  17. Makefile, and I'\''ll remind you later, after compilation, of what has
  18. to be changed elsewhere.
  19.  
  20. I need the following programs: echo, tr [-d], man, sed [-n], grep, test.
  21. '
  22.  
  23. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  24.  
  25. echo '
  26. The first versions of pty were designed on a BSD 4.2-based system.
  27. During May 1990 pty 3.0 was written completely from scratch,
  28. on a BSD 4.3-based system. It has been thoroughly tested on
  29. several BSD 4.3-based systems, tested with a few Makefile changes
  30. on several BSD 4.2-based systems, and run on at least one mutant.
  31.  
  32. If you make it through installation and testing and get pty running,
  33. please send a note to the author, Dan Bernstein, on the Internet
  34. at brnstnd@kramden.acf.nyu.edu. Let him know your computer model, OS
  35. version, and what changes you had to make. If you have any trouble,
  36. please also get in touch with the author. If you have a different kind
  37. of system with pseudo-terminal support that could use a pty port, the
  38. author would love to hear about it.
  39.  
  40. One note: Like all software, pty comes without warranty, to the extent
  41. permitted by applicable law. Use it at your own risk.
  42. '
  43.  
  44. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  45.  
  46. echo '
  47. I assume that you don'\''t want to make any major changes
  48. to your computer just to take advantage of pty'\''s capabilities.
  49. You might not even have a privileged account, for all I know.
  50.  
  51. The first major decision you have to make is what privileges to give pty.
  52. Obviously if you don'\''t have privileges then pty won'\''t either;
  53. this is Case UN.
  54. '
  55.  
  56. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  57.  
  58. echo '
  59. There are several good reasons for giving programs privileges.
  60. Most importantly, privileged programs can precisely control access
  61. to a shared resource. pty supports an interactive user list in
  62. /etc/utmp, a login-logout record in /usr/adm/wtmp, and controlled
  63. access to the pseudo-terminal files themselves, including security and
  64. mode changing. None of these are possible if pty isn'\''t setuid.
  65. '
  66.  
  67. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  68.  
  69. echo '
  70. If you do want pty to have privileges, you have to decide between
  71. setting up pty as root (Case ROOT) or as some other user, say ``pty'\'\''
  72. (Case PTY). Staying away from root has the advantage that problems
  73. can'\''t possibly destroy all security in one blow. However, root has
  74. several advantages, mainly because of BSD limitations: 1. A process
  75. can'\''t change ownership of a file between its euid and uid. Only root
  76. can change ownership. It shouldn'\''t be necessary to change ownership
  77. of ptys anyway, but that'\''s what many programs assume. 2. MAXUPRC in
  78. <sys/param.h> limits the number of processes under a given *effective*
  79. uid. This absolutely idiotic behavior is a serious problem for programs
  80. setuid to anything other than root. pty tries to work around this
  81. problem, but there are no true solutions. 3. Despite the documentation
  82. in kill(2), many machines don'\''t allow non-root processes to send
  83. CONT to children with a different uid. Unlike almost all other programs,
  84. pty sensibly handles its child stopping and restarting; but this won'\''t
  85. work on those machines if pty isn'\''t root.
  86.  
  87. You should decide now between Case ROOT and Case PTY.
  88. '
  89.  
  90. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  91.  
  92. echo '
  93. Whether you'\''ve decided on ROOT, PTY, or UN,
  94. now is the time to check the security of the entire pty package.
  95. It'\''d be difficult for anything to slip through the checks by the
  96. author, testers, and source group moderator, but you should take
  97. at least a moment to look for your pet security peeves.
  98.  
  99. A couple of security notes: The only open(,O_CREAT) in pty is in
  100. master.c, at the top of master(), of a file with a very restricted
  101. form constructed from the filename of a /dev/ttyxx. There are no
  102. creat()s. The only bind() is in sock.c'\''s pty_readsock(), which is
  103. called only from master.c'\''s master() to create a socket with a
  104. similarly restricted name. (fnsty is changed in sigler but not in
  105. master.) The only exec() is in slave.c, after a forced setreuid()
  106. to a uid that is only set to getuid(). unlink(), mkdir(), and rename()
  107. are only used with restricted pathnames.
  108. '
  109.  
  110. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  111.  
  112. echo '
  113. In Case PTY, you have to set up a new uid, say ``pty'\'\'' (or whatever
  114. username you want). pty should not allow logins. Its password should
  115. be an asterisk; its home directory should be /nonexistent; its shell
  116. should be /bin/true. In other words, the only access to user pty
  117. should be through these setuid programs.
  118.  
  119. In any privileged case you should have group tty,
  120. which most BSD 4.3 systems have as gid 4. 
  121. '
  122.  
  123. echo 'Running '\
  124. '$ ttygroup="`sed -n '\''s/^tty:[^:]*:\(.*\):.*/\1/p'\'' < /etc/group`" ...'
  125. ttygroup="`sed -n 's/^tty:[^:]*:\(.*\):.*/\1/p' < /etc/group`"
  126.  
  127. case "$ttygroup" in
  128. 4) echo '
  129. I see that you have a tty group, 4 as usual. Good.
  130. ' ;;
  131. '') echo '
  132. You don'\''t have a tty group. Unless you have a suitable group under a
  133. different name, you should add the line
  134. tty:*:4:root
  135. to /etc/group.
  136. ' ;;
  137. *) echo '
  138. I see that you have a tty group, gid '"$ttygroup"' rather than 4. Okay.
  139. ' ;;
  140. esac
  141.  
  142. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  143.  
  144. echo '
  145. Next, we'\''re going to drudge through the config.h file.
  146.  
  147. In Cases ROOT or PTY, you have to set up a system-wide directory
  148. for storing information about pty sessions. (A session is a program
  149. stuck under a pty that you can disconnect and reconnect.) Users can
  150. get around this directory, storing the information in ~/.pty and
  151. revoking any privileges, with pty -xS; you can even make this default
  152. by setting flagxsetuid = 0 in globals.c. However, a single system-wide
  153. directory is safer.
  154.  
  155. Anyway, that directory, PTYDIR, should be mode 0700, owner root in case
  156. ROOT or pty in case PTY, group irrelevant. PTYDIR is defined in config.h
  157. as /usr/etc/pty by default; if you choose a different directory, add
  158. -DPTYDIR=\"/what/ever/dir/ect/ory\" to CCOPTS in the Makefile.
  159.  
  160. In Case UN, you may want to set up a directory ~/PTY inside your home
  161. directory, and set PTYDIR to that; you may want to set flagxsetuid = 0
  162. in globals.c; or you may want to just type -xS to pty all the time. I
  163. recommend the first strategy.
  164. '
  165.  
  166. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  167.  
  168. echo '
  169. Next come pseudo-terminal pathnames. I assume that your ptys are
  170. labelled as /dev/ptyxx and /dev/ttyxx, where xx is any two-letter
  171. extension. pty can support any initial strings instead of these,
  172. but some of the utilities have /dev/tty hardcoded, and lots of other
  173. programs running around assume those names. If you'\''re desperate,
  174. define DEVMTY and DEVSTY in the Makefile, and figure out what has to
  175. be changed in util/*. (Sorry.)
  176. '
  177.  
  178. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  179.  
  180. echo '
  181. The extension is traditionally [p-za-o][0-9a-f]. The first letter of the
  182. second string is special: if /dev/ttyq0 doesn'\''t exist, for example, then
  183. none of /dev/ttyq[0-9a-f] will be used. (That'\''s called a pty bank.)
  184.  
  185. You can change those strings by defining, e.g., PTY1=\"ABCDEFG\" or
  186. PTY2=\"02468abfq\" in the Makefile. You have at least four choices here:
  187. 1. Give pty its own, new, banks of new pseudo-terminals with weird bank
  188. names not including a through z, and define PTY1 appropriately. pty will
  189. only use those new ptys, and older programs will just use the old ptys.
  190. This may require reconfiguring your system for the larger number of
  191. terminals. 2. Give pty some new banks, and take out some old ones to
  192. make up for it. 3. Give pty a chunk of the old banks. 4. Give pty all
  193. the old banks.
  194.  
  195. Note that pty searches randomly through PTY1 and PTY2 by default; for
  196. efficiency, PTY1 really should reflect exactly the pty banks you have.
  197. '
  198.  
  199. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  200.  
  201. echo '
  202. So now you'\''ve decided on new ptys, or set aside some or all of your
  203. old ptys, and changed PTY1 and PTY2 appropriately. Because BSD gives a
  204. process very little control over its controlling terminal, pty has to
  205. pass a terminal name explicitly when it reconnects. If any of your tty
  206. (not just pseudo-tty!) filenames are longer than 30 characters, you have
  207. to set -DTTYNAMELEN=60 or whatever in the Makefile.
  208. '
  209.  
  210. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  211.  
  212. echo '
  213. /etc/utmp has traditionally listed all users logged on.
  214. This nebulous concept has evolved through the years; given the way
  215. that most programs use utmp, utmp is probably better defined as a
  216. list of all interactive sessions. Anyway, pty supports this file,
  217. and will make an entry in it when given -xu. If you have a different
  218. file, add -DPTYUTMP_FILE=\"/foo/bar/utmp\" to DEFINES in the Makefile.
  219.  
  220. Note that /etc/utmp is unprotected (mode 666) on Suns. This was Sun'\''s
  221. attempt to let unprivileged programs manage the file. Unforunately, this
  222. error in judgment opens up a huge security hole, which even on
  223. single-user machines is an invitation to make mistakes. I advise you to
  224. make /etc/utmp owned by root in Case ROOT or pty in Case PTY, mode 644.
  225. There aren'\''t many unprivileged programs that don'\''t understand the
  226. pty interface; people on non-Suns have survived so far, and there'\''s
  227. no reason for you to keep subscribing to an insecure model of resource
  228. sharing.
  229. '
  230.  
  231. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  232.  
  233. echo '
  234. Although pty will put an entry into utmp, it doesn'\''t really support
  235. the remote-host field. There is no logical association between sessions
  236. and connections; why should a login require a pty, and why should a
  237. session only stick around for one connection? So pty just puts "pty" in
  238. the host field. You can change this with -DPTYUTMP_HOST=\"foo\"; you may
  239. even want to make PTY_UTMPHOST call a function that you define.
  240.  
  241. (Similar comments apply to PTYWTMP_HOST. There are also PTYUTMP_SWHOST
  242. and PTYWTMP_SWHOST, defaults PTYUTMP_HOST and "pty-sessuser"
  243. respectively; see util/sessuser.1 for more information.)
  244. '
  245.  
  246. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  247.  
  248. echo '
  249. /usr/adm/wtmp has traditionally recorded all logins, logouts, reboots,
  250. ftp sessions, and various other interesting events. (The entry for a
  251. line in utmp is the last entry for that line in wtmp.) pty supports wtmp
  252. fully, in the same way as utmp. You should make wtmp mode 644, owner
  253. root or pty as appropriate. Change PTYWTMP_FILE if /usr/adm/wtmp is
  254. somewhere else.
  255. '
  256.  
  257. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  258.  
  259. echo '
  260. You can turn off utmp support by uncommenting the NO_UTMP line in
  261. config.h. (Just delete the initial /*.) You can also turn off support
  262. for wtmp, disconnectable sessions, or changing pseudo-terminal file
  263. ownership; just uncomment the appropriate line. You can force use of
  264. each of these features by defining MUST_UTMP, etc., in the same way.
  265.  
  266. Note that the usual login programs do their own wtmp management, and
  267. many accounting programs incorrectly equate session time with connect
  268. time, so users will rarely want wtmp. As more programs appear using the
  269. pty interface, and as login programs start using a more logical system
  270. for accounting, MUST_WTMP may become an appropriate way to monitor
  271. pseudo-terminal usage. For the moment, I do not advise setting any NO
  272. or MUST.
  273. '
  274.  
  275. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  276.  
  277. echo '
  278. pty subscribes (not very willingly) to the BSD 4.3 model of pty
  279. protection, with a few twists. All ptys are under group tty, at all
  280. times; if you don'\''t have a tty group, all ptys should be under some
  281. other protected group at all times. Anyway, pty will change the group of
  282. each pseudo-terminal file to PTYGROUP, default 4, under -xc.
  283. '
  284.  
  285. case "$ttygroup" in
  286. 4) echo '
  287. Since you already have a tty group, gid 4, you'\''re fine.
  288. ' ;;
  289. '') echo '
  290. You don'\''t have a tty group. You should pick a gid and define
  291. -DPTYGROUP=whatever in the Makefile.
  292. ' ;;
  293. *) echo '
  294. You have a tty group, but it'\''s not gid 4. You should define
  295. -DPTYGROUP='"$ttygroup"' in the Makefile.
  296. ' ;;
  297. esac
  298.  
  299. echo '
  300. (Under Case UN, don'\''t worry about all this group stuff. Just leave
  301. PTYGROUP alone.)
  302. '
  303.  
  304. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  305.  
  306. echo '
  307. Under -xc, pty changes the pseudo-terminal owner to the current real
  308. uid. The fact that terminals need to be in the file hierarchy reflects a
  309. serious failure in the BSD terminal model; but anyway, many programs
  310. expect to be able to fool around with /dev/tty. After pty is done with
  311. the terminal, it sets the owner back to its effective uid. You can
  312. modify this behavior by changing PTYOWNER from euid to something else.
  313.  
  314. Under Case UN, PTYOWNER is irrelevant.
  315. '
  316.  
  317. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  318.  
  319. echo '
  320. While a tty is unused, BSD systems traditionally leave it unprotected.
  321. Unfortunately, this leaves some huge security holes. Here'\''s one of
  322. the biggest advantages of a privileged pty manager: unused ttys don'\''t
  323. have to be left open for any random program to use. After it'\''s done
  324. with a pseudo-terminal, pty changes it to mode UNUSEDPTYMODE, default
  325. 0600. (This is another case of a poor model for kludging pty support
  326. into unprivileged programs. If you haven'\''t set up separate pty banks
  327. for pty, and you really want to allow unprivileged access to unused
  328. ptys, try mode 0660 and make those other programs setgid to tty.)
  329.  
  330. A tty that someone'\''s using can be in many different modes. Typically
  331. USEDPTYMODE should be 0600, which means user-only access, messages off,
  332. biff off. If you really, really, really want to make the mistake of
  333. having messages or biff on by default, try 0620, 0700, or 0720. Note
  334. that the world protection should always be 0: the point of the tty group
  335. is that only setgid-tty programs can access ttys.
  336.  
  337. As usual, you can'\''t do anything about these in Case UN.
  338. '
  339.  
  340. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  341.  
  342. echo '
  343. Now we'\''re past generic configuration and down to your system'\''s
  344. nitty-gritty.
  345.  
  346. For purity, pty has SIGRET_TYPE, default int, as the type returned by a
  347. signal handler. On Suns and ANSI-compliant machines, you should define
  348. SIGRET_TYPE=void. Then you can admire the lint -haxc *.c output.
  349. '
  350.  
  351. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  352.  
  353. echo '
  354. OUTBUFSIZE, default 16384, is the size of the buffer pty keeps between
  355. the incoming data and the pseudo-tty, and between the pseudo-tty and the
  356. outgoing data. If you want to spare less than 32K per pty just for
  357. buffer space, feel free to change this.
  358. '
  359.  
  360. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  361.  
  362. echo '
  363. GENERIC is another concession to ANSI taste. GENERIC * should be a
  364. pointer type that any other pointer can be safely converted to and back;
  365. GENERIC is char by default, but on newer machines can be set to void.
  366. As it'\''ll be at least five years before ANSI manages to outlaw char *,
  367. and as void * is often invalid, I advise you to leave GENERIC alone.
  368. '
  369.  
  370. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  371.  
  372. echo '
  373. pty attempts to forward window-size changes transparently. It also
  374. supports the auxiliary characters structure, which lets you type a
  375. single character to get system and tty status.
  376. '
  377.  
  378. echo 'Running $ man 4 tty | sed '\''s/_//g'\'' | grep -s winsize'
  379. if man 4 tty | sed 's/_//g' | grep -s winsize
  380. then havewin=y; echo '
  381. I see you have window sizes.
  382. '
  383. else havewin=n; echo '
  384. I see you don'\''t have window sizes.
  385. You'\''ll have to comment out #define TTY_WINSIZE in config.h.
  386. (This may be inaccurate on Suns; try grep winsize /usr/include/sys/tt*.h.)
  387.      case "$ttygroup" in
  388.      4) ;;
  389.      '') echo '(Let me guess: This isn'\''t a BSD 4.3 system.)' ;;
  390.      *) ;;
  391.      esac
  392. fi
  393.  
  394. echo 'Running $ man 4 tty | sed '\''s/_//g'\'' | grep -s auxchars'
  395. if man 4 tty | sed 's/_//g' | grep -s auxchars
  396. then haveaux=y; echo '
  397. I see you have auxiliary characters.
  398. You should uncomment #define TTY_AUXCHARS in config.h.
  399. '
  400. else haveaux=n; echo '
  401. I see you don'\''t have auxiliary characters.
  402. '
  403. fi
  404.  
  405. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  406.  
  407. echo '
  408. pty also puts siginterrupt() and usleep() to good use in working
  409. around BSD limitations. Without siginterrupt(), there is absolutely
  410. no way to get per-process non-blocking I/O, so pty may block when it
  411. doesn'\''t have to (namely, when it has N bytes to write to the output,
  412. the output is a pipe with M bytes of space, and N > M > 0). If you
  413. define SIGINTERRUPT (as default), pty will take some extra effort to
  414. never, ever, ever block when it doesn'\''t have to.
  415.  
  416. At one point, pty pauses to kludge around a common bug in UNIX-domain
  417. sockets. With usleep() it will pause much more briefly. This makes
  418. reconnects much faster.
  419. '
  420.  
  421. echo 'Running terrupt(). Good.
  422. '
  423.      case "$ttygroup$havewinsize" in
  424.      4y) echo 'I'\''ll bet you'\''re a BSD 4.3 system.' ;;
  425.      *) echo 'Weird, are you BSD 4.3?' ;;
  426.      esac
  427. else havesigintr=n; echo '
  428. I see you don'\''t have siginterrupt(). You have to comment out
  429. #define SIGINTERRUPT in config.h.
  430. '
  431. fi
  432.  
  433. echo 'Running $ man usleep | sed '\''s/_//g'\'' | grep -s usleep'
  434. if man usleep | sed 's/_//g' | grep -s usleep
  435. then haveusleep=y; echo '
  436. I see you have usleep(). Good.
  437. '
  438. else haveusleep=n; echo '
  439. I see you don'\''t have usleep(). You have to comment out
  440. #define USLEEP in config.h.
  441. '
  442. fi
  443.  
  444. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  445.  
  446. echo '
  447. Finally (almost done with configuration!), we have to make sure that you
  448. have UNIX-domain sockets, and check whether you have file descriptor
  449. passing.
  450. '
  451.  
  452. echo 'Running $ test -r /usr/include/sys/un.h'
  453. if test -r /usr/include/sys/un.h
  454. then haveunsocks=y; echo '
  455. I see you have UNIX-domain sockets. Good.
  456. '
  457.    echo 'Running $ man recvmsg | sed '\''s/_//g'\'' | grep -s rights'
  458.    if man recvmsg | sed 's/_//g' | grep -s rights
  459.    then havefdpass=y; echo '
  460. I see you have file descriptor passing. Good. (Your fd passing may be
  461. buggy, as it'\''s a relatively new, powerful, and rarely exploited
  462. feature. If you have trouble, try defining NO_FDPASSING.)
  463. '
  464.    else havefdpass=n; echo '
  465. I see you don'\''t have file descriptor passing. This isn'\''t a
  466. disaster, though it means that reconnected sessions will be as
  467. inefficient as they are in programs other than this one, boo hoo hoo.
  468. Uncomment NO_FDPASSING in config.h.
  469. '
  470.    fi
  471. else haveunsocks=n; echo '
  472. Uh-oh. I don'\''t see <sys/un.h>, which means you probably don'\''t have
  473. UNIX-domain sockets. Without sockets you can'\''t have disconnectable
  474. sessions. Sigh. I guess you have to define NO_UNIXSOCKS in config.h.
  475. '
  476. fi
  477.  
  478. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  479.  
  480. echo '
  481. Whew! We'\''ve finally made it through configuration. If you want, try
  482. running lint -haxc *.c or whatever your favorite code checker is; the
  483. lint here gives some bogus errors about correct char * casts, an error
  484. because the SIG_IGN definition is unportable, and a couple of bzero
  485. complaints because FD_ZERO isn'\''t defined very well.
  486.  
  487. If you'\''re on an old system without FD_ZERO, FD_SET, and FD_ISSET in
  488. <sys/types.h>, I recommend you upgrade. Try copying file.h.old to file.h
  489. (the original version is in file.h.new).
  490.  
  491. We'\''re nearly at the end. Change CC and CCOPTS in the Makefile for any
  492. last-minute additions; if you'\''re worried, change -s to -g for debugging.
  493. Now compile! % (date; make) >>& Makelog & and come back to this script.
  494. '
  495.  
  496. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  497.  
  498. echo '
  499. While the program is compiling, let'\''s start providing some support.
  500. (If the compile finishes or has an error, just ignore it for the
  501. moment.) These are some real changes, so watch out!
  502.  
  503. First, in Case PTY, make a new uid, pty, not allowing logins.
  504.  
  505. /etc/passwd:  pty:*:whatever:4:::/bin/true
  506. '
  507.  
  508. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  509.  
  510. echo '
  511. Second, make sure you have a tty group set up.
  512.  
  513. /etc/group:  tty:*:4:root
  514. '
  515.  
  516. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  517.  
  518. echo '
  519. Third, make PTYDIR.
  520.  
  521. ROOT: # mkdir /usr/etc/pty; chmod 700 /usr/etc/pty
  522. PTY: # mkdir /usr/etc/pty; chown pty /usr/etc/pty; chmod 700 /usr/etc/pty
  523. UN: % mkdir ~/PTY; chmod 700 ~/PTY
  524. '
  525.  
  526. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  527.  
  528. echo '
  529. Fourth, make sure you have all the pseudo-terminal files set up and
  530. appropriately configured.
  531.  
  532. Change each of them to group tty.
  533.  
  534. Change each of them to owner pty in case PTY or root in case ROOT.
  535.  
  536. Change each of them to mode UNUSEDPTYMODE (0600).
  537. '
  538.  
  539. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  540.  
  541. echo '
  542. Fifth, make sure /etc/utmp and /usr/adm/wtmp exist, owned by root in
  543. Case ROOT or pty in Case PTY, each mode 644. (In Case UN, you probably
  544. want to be working on a Sun with its insecure /etc/utmp, so that pty can
  545. take advantage of it. Sigh.)
  546. '
  547.  
  548. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  549.  
  550. echo '
  551. Sixth, I advise that you make a special directory /usr/local/ptybin for
  552. pty and its associated utilities, with symbolic links in /usr/local.
  553. This choice isn'\''t too important, but it'\''s easier if you know a
  554. place to put programs.
  555. '
  556.  
  557. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  558.  
  559. echo '
  560. Okay. You'\''ve done about all that can be done before compilation
  561. finishes, so go do something else.
  562. '
  563.  
  564. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  565.  
  566. echo '
  567. The compile should be done now. If all went well, the make should have
  568. exited normally, Makelog should show no errors, and you should have an
  569. executable pty program sitting in this directory. Unfortunately, life
  570. isn'\''t always so generous. Here are a few of the more common errors.
  571.  
  572. The loader complains about missing getopt(), optarg, and optind: These
  573. are all in the getopt library, available in the early volumes of
  574. comp.sources.unix. If you use GNU getopt, please make sure you
  575. understand the implications of its license.
  576.  
  577. The loader complains about missing FD_ZERO, FD_SET, and FD_ISSET: Try
  578. copying file.h.old to file.h and recompiling. If the compiler gives
  579. various further errors related to these macros, uncomment the
  580. commented-out lines in file.h.old, copy to file.h, and try once again.
  581.  
  582. bcopy() isn'\''t defined: In pty.h, change bcopy(src,dst,num) to
  583. memcpy(dst,src,num). (Note the order.) Try again.
  584.  
  585. If you still can'\''t get the code to compile, let the author know.
  586. '
  587.  
  588. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  589.  
  590. echo '
  591. Next, compile the utilities. There isn'\''t much to say about them;
  592. they'\''re all public domain, some of them clones of or improvements
  593. over standard utilities, some of them clones with special features to
  594. work with pty, some of them entirely new programs for pty'\''s new
  595. features. Just glance at the top of util/Makefile; then
  596. % cd util; (date; make) >>& Makelog & and wait.
  597. '
  598.  
  599. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  600.  
  601. echo '
  602. So now you should have some executables sitting around collecting dust.
  603. In Cases ROOT and PTY, put {pty,biff,disconnect,mesg,reconnect,sesskill,
  604. sesslist,sessname,sessuser} into a system-wide directory, owner root or
  605. pty, mode 4755. Put wall and write into the same place, group tty, mode
  606. 2755. Put {condom,excloff,exclon,last,lock,script,script.tidy,sess,tiocsti,
  607. tty,u,who,xdisconnect,xreconnect,xsesskill,xsesslist,xsessname,xsessuser}
  608. into the same place, mode 755. Make absolutely sure none of the shell
  609. scripts are setuid.
  610.  
  611. In Case UN, just put all the programs somewhere in your PATH.
  612.  
  613. That'\''s it! Try running TESTS now.
  614.  
  615. (Two other things you have to do at some point: move your old script,
  616. biff, mesg, and so on to script.old, biff.old, mesg.old, etc., with
  617. symbolic links to the new versions in their place; and move the old
  618. /usr/man/{script,biff,mesg,...}.1 somewhere else, copy all the *.1
  619. here to /usr/man/man1, and run /etc/catman.)
  620. '
  621.