help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Set init-file-user via whoami shell command? Prevent load of USER or LOG


From: Mark Mynsted
Subject: Set init-file-user via whoami shell command? Prevent load of USER or LOGIN init file
Date: 18 Apr 2003 11:36:52 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

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.                           / \


reply via email to

[Prev in Thread] Current Thread [Next in Thread]