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