Make Info-mode usable with UTF-8 info docs.
[sxemacs] / etc / gnuserv.1
1 .TH GNUSERV 1 "" "XEmacs Server"
2 .UC 4
3 .SH NAME
4 gnuserv, gnuclient \- Server and Clients for XEmacs
5 .SH SYNOPSIS
6 .B gnuclient
7 [-nw] [-display display] [-q] [-v] [-l library] [-batch] [-f function] [-eval form] 
8 [-h hostname] [-p port] [-r remote-pathname] [[+line] file] ...
9 .br
10 .B gnuserv
11 .br
12 .SH DESCRIPTION
13
14 .PP
15 \fIgnuclient\fP allows the user to request a running XEmacs process to
16 edit the named files or directories and/or evaluate lisp forms.
17 Depending on your environment, it can be an X frame or a TTY frame.
18 One typical use for this is with a dialup connection to a machine on
19 which an XEmacs process is currently running.
20 .PP
21 \fIgnuserv\fP is the server program that is set running by XEmacs to
22 handle all incoming and outgoing requests. It is not usually invoked
23 directly, but is started from XEmacs by loading the \fIgnuserv\fP
24 package and evaluating the Lisp form (gnuserv-start).
25 .SH OPTIONS
26 .PP 
27 \fIgnuclient\fP supports as much of the command line options of Emacs as
28 makes sense in this context. In addition it adds a few of its own. 
29 .br
30 Options with long names can also be specified using a double
31 hyphen instead of a single one.
32 .TP 8
33 .BI \-nw
34 This option makes \fIgnuclient\fP act as a frontend such that XEmacs
35 can attach to the current TTY. XEmacs will then open a new TTY frame.
36 The effect is similar to having started a new XEmacs on this TTY with
37 the ``-nw'' option. It currently only works if XEmacs is running on
38 the same machine as gnuclient. This is the default if the `DISPLAY'
39 environment variable is not set.
40 .TP 8
41 .BI \-display " display, " \--display " display" 
42 If this option is given or the `DISPLAY' environment variable is set
43 then gnuclient will tell XEmacs to edit files in a frame on the
44 specified X device.
45 .TP 8
46 .BI \-q
47 This option informs \fIgnuclient\fP to exit once connection has been
48 made with the XEmacs process.  Normally \fIgnuclient\fP waits until
49 all of the files on the command line have been finished with (their
50 buffers killed) by the XEmacs process, and all the forms have been
51 evaluated.
52 .TP 8
53 .BI \-v
54 When this option is specified \fIgnuclient\fP will request for the
55 specified files to be viewed instead of edited.
56 .TP 8
57 .BI \-l " library"
58 Tell Emacs to load the specified library.
59 .TP 8
60 .BI \-batch
61 Tell Emacs not to open any frames. Just load libraries and evaluate
62 lisp code.  If no files to execute, functions to call or forms to eval 
63 are given using the
64 .BR \-l ,
65 .BR \-f ,
66 or
67 .B \-eval
68 options, then forms to eval are read from STDIN.
69 .TP 8
70 .BI \-f " function," 
71 Make Emacs execute the lisp function.
72 .TP 8
73 .BI \-eval " form"
74 Make Emacs execute the lisp form.
75 .TP 8
76 .BI \-h " hostname"
77 Used only with Internet-domain sockets, this option specifies the host
78 machine which should be running \fIgnuserv\fP. If this option is not
79 specified then the value of the environment variable GNU_HOST is used
80 if set. If no hostname is specified, and the GNU_HOST variable is not
81 set, an internet connection will not be attempted. N\.B.:
82 \fIgnuserv\fP does NOT allow internet connections unless XAUTH
83 authentication is used or the GNU_SECURE variable has been specified
84 and points at a file listing all trusted hosts. (See SECURITY below.)
85
86 .br
87 Note that an internet address may be specified instead of a hostname
88 which can speed up connections to the server by quite a bit,
89 especially if the client machine is running YP.
90
91 .br
92 Note also that a hostname of \fBunix\fP can be used to specify that
93 the connection to the server should use a Unix-domain socket (if
94 supported) rather than an Internet-domain socket.
95 .TP 8
96 .BI \-p " port"
97 Used only with Internet-domain sockets, this option specifies the
98 service port used to communicate between server and clients.  If this
99 option is not specified, then the value of the environment variable
100 GNU_PORT is used, if set, otherwise a service called ``gnuserv'' is
101 looked up in the services database.  Finally, if no other value can be
102 found for the port, then a default port is used which is usually 21490
103 + uid.
104 .br
105 Note that since \fIgnuserv\fP doesn't allow command-line options, the port for
106 it will have to be specified via one of the alternative methods.
107 .TP 8
108 .BI \-r " pathname"
109 Used only with Internet-domain sockets, the pathname argument may be
110 needed to inform XEmacs how to reach the root directory of a remote
111 machine.  \fIgnuclient\fP prepends this string to each path argument
112 given.  For example, if you were trying to edit a file on a client
113 machine called otter, whose root directory was accessible from the
114 server machine via the path /net/otter, then this argument should be
115 set to '/net/otter'.  If this option is omitted, then the value is
116 taken from the environment variable GNU_NODE, if set, or the empty
117 string otherwise.
118 .TP 8
119 .BI "[+n] file"
120 This is the path of the file to be edited.  If the file is a directory, then
121 the directory browsers dired or monkey are usually invoked instead.
122 The cursor is put at line number 'n' if specified.
123
124 .SH SETUP
125 \fIgnuserv\fP is packaged standardly with recent versions of XEmacs.
126 Therefore, you should be able to start the server simply by evaluating
127 the XEmacs Lisp form (gnuserv-start), or equivalently by typing
128 `M-x gnuserv-start'.
129
130 .SH CONFIGURATION
131 The behavior of this suite of program is mostly controlled on the lisp 
132 side in Emacs and its behavior can be customized to a large extent.
133 Type `M-x customize-group RET gnuserv RET' for easy access. More
134 documentation can be found in the file `gnuserv.el'
135
136 .SH EXAMPLE
137 .RS 4
138 gnuclient -q -f mh-smail
139 .br
140 gnuclient -h cuckoo -r /ange@otter: /tmp/*
141 .br
142 gnuclient -nw ../src/listproc.c
143 .RE
144 .br
145
146 .br
147 More examples and sample wrapper scripts are provided in the
148 etc/gnuserv directory of the Emacs installation.
149
150
151 .SH SYSV IPC
152 SysV IPC is used to communicate between \fIgnuclient\fP and
153 \fIgnuserv\fP if the symbol SYSV_IPC is defined at the top of
154 gnuserv.h. This is incompatible with both Unix-domain and
155 Internet-domain socket communication as described below. A file called
156 /tmp/gsrv??? is created as a key for the message queue, and if removed
157 will cause the communication between server and client to fail until
158 the server is restarted.
159 .SH UNIX-DOMAIN SOCKETS
160 A Unix-domain socket is used to communicate between \fIgnuclient\fP
161 and \fIgnuserv\fP if the symbol UNIX_DOMAIN_SOCKETS is defined at the
162 top of gnuserv.h.  A file called /tmp/gsrvdir????/gsrv is created for
163 communication.  If the symbol USE_TMPDIR is set at the top of gnuserv.h,
164 $TMPDIR, when set, is used instead of /tmp.  If that file is deleted,
165 or TMPDIR has different values for the server and the client, communication
166 between server and client will fail.  Only the user running gnuserv will be
167 able to connect to the socket.
168 .SH INTERNET-DOMAIN SOCKETS
169 Internet-domain sockets are used to communicate between
170 \fIgnuclient\fP and \fIgnuserv\fP if the symbol
171 INTERNET_DOMAIN_SOCKETS is defined at the top of gnuserv.h. Both
172 Internet-domain and Unix-domain sockets can be used at the same
173 time. If a hostname is specified via -h or via the GNU_HOST
174 environment variable, \fIgnuclient\fP establish connections using an
175 internet domain socket. If not, a local connection is attempted via
176 either a unix-domain socket or SYSV IPC.
177 .SH SECURITY
178 Using Internet-domain sockets, a more robust form of security is
179 needed that wasn't necessary with either Unix-domain sockets or SysV
180 IPC. Currently, two authentication protocols are supported to provide
181 this: MIT-MAGIC-COOKIE-1 (based on the X11 xauth(1) program) and a
182 simple host-based access control mechanism, hereafter called
183 GNUSERV-1. The GNUSERV-1 protocol is always available, whereas support
184 for MIT-MAGIC-COOKIE-1 may or may not have been enabled (via a #define
185 at the top of gnuserv.h) at compile-time.
186 .PP
187 \fIgnuserv\fP, using GNUSERV-1, performs a limited form of access
188 control at the machine level. By default no internet-domain socket is
189 opened.  If the variable GNU_SECURE can be found in \fIgnuserv\fP's
190 environment, and it names a readable filename, then this file is
191 opened and assumed to be a list of hosts, one per line, from which the
192 server will allow requests. Connections from any other host will be
193 rejected. Even the machine on which \fIgnuserv\fP is running is not
194 permitted to make connections via the internet socket unless its
195 hostname is explicitly specified in this file.  Note that a host may
196 be either a numeric IP address or a hostname, and that
197 .I any
198 user on an approved host may connect to your gnuserv and execute arbitrary
199 elisp (e.g., delete all your files).
200 If this file contains a lot of
201 hostnames then the server may take quite a time to start up.
202 .PP
203 When the MIT-MAGIC-COOKIE-1 protocol is enabled, an internet socket
204 \fIis\fP opened by default. \fIgnuserv\fP will accept a connection from
205 any host, and will wait for a "magic cookie" (essentially, a password)
206 to be presented by the client. If the client doesn't present the
207 cookie, or if the cookie is wrong, the authentication of the client is
208 considered to have failed. At this point. \fIgnuserv\fP falls back to
209 the GNUSERV-1 protocol; If the client is calling from a host listed in
210 the GNU_SECURE file, the connection will be accepted, otherwise it
211 will be rejected. 
212 .TP 4
213 .I  Using MIT-MAGIC-COOKIE-1 authentication
214 When the \fIgnuserv\fP server is started, it looks for a cookie
215 defined for display 999 on the machine where it is running. If the
216 cookie is found, it will be stored for use as the authentication
217 cookie. These cookies are defined in an authorization file (usually
218 ~/.Xauthority) that is manipulated by the X11 xauth(1) program. For
219 example, a machine "kali" which runs an emacs that invokes
220 \fIgnuserv\fP should respond as follows (at the shell prompt) when set
221 up correctly.
222 .PP
223 .RS 8
224 kali% xauth list
225 .br
226 GS65.SP.CS.CMU.EDU:0  MIT-MAGIC-COOKIE-1  11223344
227 .br
228 KALI.FTM.CS.CMU.EDU:999  MIT-MAGIC-COOKIE-1  1234
229 .RE
230 .PP
231 .RS 4
232 In the above case, the authorization file defines two cookies. The
233 second one, defined for screen 999 on the server machine, is used for
234 gnuserv authentication. 
235 .PP
236 On the client machine's side, the authorization file must contain an
237 identical line, specifying the 
238 .I server's 
239 cookie. In other words, on a machine "foobar" which wishes to connect
240 to "kali,"  the `xauth list' output should contain the line:
241 .PP
242 .RS 4
243 KALI.FTM.CS.CMU.EDU:999  MIT-MAGIC-COOKIE-1  1234
244 .RE
245 .PP
246 For more information on authorization files, take a look at the
247 xauth(1X11) man page, or invoke xauth interactively (without any
248 arguments) and type "help" at the prompt. Remember that case in the
249 name of the authorization protocol (i.e.`MIT-MAGIC-COOKIE-1') 
250 .I is
251 significant!
252 .RE
253
254
255 .SH ENVIRONMENT
256 .PP
257 .TP 8
258 .B DISPLAY
259 Default X device to put edit frame.
260
261 .SH FILES
262 .PP
263 .TP 8
264 .B /tmp/gsrv???
265 (SYSV_IPC only)
266 .TP 8
267 .B /tmp/gsrvdir???/gsrv
268 (unix domain sockets only)
269 .TP 8
270 .B ~/.emacs
271 XEmacs customization file, see xemacs(1).
272 .SH SEE ALSO
273 .PP
274 .TP 8
275 xauth(1X11), Xsecurity(1X11), gnuserv.el
276
277 .SH AUTHOR.
278 Andy Norman (ange@hplb.hpl.hp.com), based heavily upon
279 etc/emacsclient.c, etc/server.c and lisp/server.el from the GNU Emacs
280 18.52 distribution.  Various modifications from Bob Weiner (weiner@mot.com),
281 Darrell Kindred (dkindred@cmu.edu), Arup Mukherjee (arup@cmu.edu), Ben
282 Wing (ben@xemacs.org) and Hrvoje Niksic (hniksic@xemacs.org).