I'd like to ensure that only I can connect to an emacs server that I initialised. I frequently use machines that other people could be SSH'd into, and I don't see what's to stop them opening emacsclient
and running M-x kill-emacs
which would screw me over.
I looked at the documentation for emacsserver
and emacsclient
but couldn't find what I was looking for.
Is there a way to do this?
The simplest way to use the emacsclient program is to run the shell command ' emacsclient file ', where file is a file name. This connects to an Emacs server, and tells that Emacs process to visit file in one of its existing frames—either a graphical frame, or one in a text terminal (see Frames and Graphical Displays).
1 Answer. Show activity on this post. Simply use (daemonp) which will return t if emacs is running as a daemon.
That happens out of the box, of course! The Emacs server creates a socket that only you can access (permissions 600 or 700, in a directory with permissions 600 for good measure).
It looks like you can specify server-socket-file
for the server and server-socket-dir
for emacsclient. Simply place the socket in a directory where only you have access and you should be set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With