unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* sudo emacsclient can't find the path to the user emacsserver.
@ 2011-10-24 10:06 Clément Aymé
  2011-10-24 16:04 ` Victor Ananjevsky
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Clément Aymé @ 2011-10-24 10:06 UTC (permalink / raw)
  To: help-gnu-emacs

Here is the case:
I got a emacsserver running as a Linux ubuntu normal user that is 
working fine.
When I switch under sudo the path to the emacsserver is lost:

For example
sudo emacsclient /etc/udev/rules.d/51-android.rules
returns
emacsclient: can't find socket; have you started the server?
To start the server in Emacs, type "M-x server-start".
emacsclient: No socket or alternate editor. Please use:

--socket-name
--server-file (or environment variable EMACS_SERVER_FILE)
--alternate-editor (or environment variable ALTERNATE_EDITOR)

And what I would like is to use the same emacs server as in user mode 
not having any additional one ...

Also this doesn't work as it is said into the sudo manual
sudo -u <username> emacsclient ....
the file is effectively loaded into the emacs server but still remains 
read-only
so any help welcome...

What could be the work-around here ?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: sudo emacsclient can't find the path to the user emacsserver.
  2011-10-24 10:06 sudo emacsclient can't find the path to the user emacsserver Clément Aymé
@ 2011-10-24 16:04 ` Victor Ananjevsky
  2011-10-25 10:25 ` XeCycle
  2011-10-25 22:09 ` PJ Weisberg
  2 siblings, 0 replies; 4+ messages in thread
From: Victor Ananjevsky @ 2011-10-24 16:04 UTC (permalink / raw)
  To: help-gnu-emacs

В Mon, 24 Oct 2011 12:06:15 +0200
Clément Aymé <clmnt.wrk@gmail.com> писал:

> 
> What could be the work-around here ?
> 

sudo -E ...

-- 
Victor Ananjevsky <ananasik@gmail.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: sudo emacsclient can't find the path to the user emacsserver.
  2011-10-24 10:06 sudo emacsclient can't find the path to the user emacsserver Clément Aymé
  2011-10-24 16:04 ` Victor Ananjevsky
@ 2011-10-25 10:25 ` XeCycle
  2011-10-25 22:09 ` PJ Weisberg
  2 siblings, 0 replies; 4+ messages in thread
From: XeCycle @ 2011-10-25 10:25 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1395 bytes --]

Clément Aymé <clmnt.wrk@gmail.com> writes:

> Here is the case:
> I got a emacsserver running as a Linux ubuntu normal user that is
> working fine.
> When I switch under sudo the path to the emacsserver is lost:
>
> For example
> sudo emacsclient /etc/udev/rules.d/51-android.rules
> returns
> emacsclient: can't find socket; have you started the server?
> To start the server in Emacs, type "M-x server-start".
> emacsclient: No socket or alternate editor. Please use:
>
> --socket-name
> --server-file (or environment variable EMACS_SERVER_FILE)
> --alternate-editor (or environment variable ALTERNATE_EDITOR)
>
> And what I would like is to use the same emacs server as in user
> mode not having any additional one ...
>
> Also this doesn't work as it is said into the sudo manual
> sudo -u <username> emacsclient ....
> the file is effectively loaded into the emacs server but still
> remains read-only
> so any help welcome...
>
> What could be the work-around here ?

I don't think the file will be opened by `emacsclient' in this way ---
it should be opened by `emacs'.  If you want to edit the file as root,
try tramp, e.g.:

C-x C-f /sudo::/etc/udev/rules.d/51-android.rules

-- 
Carl Lei (XeCycle)
Department of Physics, Shanghai Jiao Tong University
OpenPGP public key: 7795E591
Fingerprint: 1FB6 7F1F D45D F681 C845 27F7 8D71 8EC4 7795 E591

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: sudo emacsclient can't find the path to the user emacsserver.
  2011-10-24 10:06 sudo emacsclient can't find the path to the user emacsserver Clément Aymé
  2011-10-24 16:04 ` Victor Ananjevsky
  2011-10-25 10:25 ` XeCycle
@ 2011-10-25 22:09 ` PJ Weisberg
  2 siblings, 0 replies; 4+ messages in thread
From: PJ Weisberg @ 2011-10-25 22:09 UTC (permalink / raw)
  To: Clément Aymé; +Cc: help-gnu-emacs@gnu.org

[-- Attachment #1: Type: text/plain, Size: 376 bytes --]

Short version:

$ export EDITOR='emacsclient -c'
$ sudoedit /etc/foo.conf

Of course emacsclient can't find the Emacs server when you run it as
root--root isn't running an Emacs server.

Furthermore, if root's emacsclient *did* connect to the normal user's Emacs
server, you would have the normal user's permissions and still wouldn't be
able to edit the file.  ;-)

-- 

-PJ

[-- Attachment #2: Type: text/html, Size: 448 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-10-25 22:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-24 10:06 sudo emacsclient can't find the path to the user emacsserver Clément Aymé
2011-10-24 16:04 ` Victor Ananjevsky
2011-10-25 10:25 ` XeCycle
2011-10-25 22:09 ` PJ Weisberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).