all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Set init-file-user via whoami shell command? Prevent load of USER or LOGIN init file
@ 2003-04-18 16:36 Mark Mynsted
  2003-04-18 18:20 ` Kevin Rodgers
  2003-04-18 18:48 ` Kai Großjohann
  0 siblings, 2 replies; 5+ messages in thread
From: Mark Mynsted @ 2003-04-18 16:36 UTC (permalink / raw)


I want emacs to load the init file for the effective user, i.e. when
I su to a different user I wan that user's init file to load.

The documentation says:
"
How Emacs Finds Your Init File
------------------------------

   Normally Emacs uses the environment variable `HOME' to find
`.emacs'; that's what `~' means in a file name.  But if you run Emacs
from a shell started by `su', Emacs tries to find your own `.emacs',
not that of the user you are currently pretending to be.  The idea is
that you should get your own editor customizations even if you are
running as the super user.

   More precisely, Emacs first determines which user's init file to use.
It gets the user name from the environment variables `LOGNAME' and
`USER'; if neither of those exists, it uses effective user-ID.  If that
user name matches the real user-ID, then Emacs uses `HOME'; otherwise,
it looks up the home directory corresponding to that user name in the
system's data base of users.
"

This is precisely the behavior I do not want.  I think that if I can
somehow set the value of init-file-user to the effective user in the
site init file, then I would be fine.  

How can I get the value of the effective user?

The following shell-command function loads the correct value, but puts
it in the buffer, not in a result that I know how to use.
(shell-command "whoami" 1)

How can I get the value something like the following to work?
(set-variable 'init-file-user (shell-command "whoami" 1))

This is clearly not going to work but there must be a way to grab the
output of a shell command without creating an new buffer, writing the
value to the new buffer, then deleting the buffer . . .

Any ideas?  Anybody do this already?

-- 
-MM
I rarely read email from this address          /"\
because of spam.                               \ /     ASCII Ribbon Campaign
I MAY see it if you put #NOTSPAM#               X      Against HTML Mail
in the subject line.                           / \

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

end of thread, other threads:[~2003-04-18 20:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-18 16:36 Set init-file-user via whoami shell command? Prevent load of USER or LOGIN init file Mark Mynsted
2003-04-18 18:20 ` Kevin Rodgers
2003-04-18 20:07   ` Mark Mynsted
2003-04-18 18:48 ` Kai Großjohann
2003-04-18 20:10   ` Mark Mynsted

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.