Subject: bug#1540: emacsclient -t fails under su

From: Dan Nicolaescu <[email-masked]>
Date: Thu, 11 Dec 2008 17:18:24 -0800 (PST)

Glenn Morris <[email-masked]> writes:

  > I know nothing about how this all works, but my naive expectation was
  > that since emacs -nw works, emacsclient -t should too.

A little explanation what is going on.  Given this example:

  > user1> su - user2
  > user2> emacs -Q -nw
  > user2> emacs -Q -f server-start &    # works fine
  > user2> emacsclient -c                # works fine
  > user2> emacsclient -t
  > *ERROR*: Could not open file: /dev/pts/12
  > 
  > (and indeed user2 does not have permissions for this file)

emacs tries to open the tty of the emacsclient process, which 
ttyname (fileno (stdout)) says it's /dev/pts/12
/dev/pts/12 is owned by user1, and user2 has no access to it