0

I was wondering whether there is a way to ask for a specific password when booting Emacs? I think I can ask for a pre-defined password which I can define in my .emacs file but I dont know how? I'm mainly interested to do this in an x- or graphical environment..

btw, I do know that the .emacs file can be seen and etc..but in my case it's not an issue.

Arash
  • 568
  • 3
  • 17
  • I'm not sure I get it. So what you want is that Emacs shows a dialog window on startup in which it asks for a password?! If you don't have the right password, what happens, Emacs shuts down? And you want to store a password in your `~/.emacs` file even though that is readable for everyone?! – Thomas Jul 17 '12 at 01:01
  • @Thomas: thanks man, Well although it is really stupid as it seems but that's what I need. I will be able to restrict access to .emacs at the OS level though..any idea how to do it? – Arash Jul 17 '12 at 09:29
  • encryption of .emacs will be best way to achieve this - because you potentially can open .emacs with other tools... – Alex Ott Jul 17 '12 at 10:00
  • @AlexOtt, I have mentioned in my question that Im aware of this. thx anyway. – Arash Jul 17 '12 at 12:58

2 Answers2

2

I use epg to keep encrypted data in file. Then it simply loaded as normal emacs lisp file, as in my config. EPG will automatically ask for passphrase, and you can analyze return code of load function to determine, was loading successful or not

Alex Ott
  • 80,552
  • 8
  • 87
  • 132
  • Thanks, but I checked it and I think the encryption part is not what I need now. Any Idea how I can do it as mentioned in the question? – Arash Jul 16 '12 at 21:04
  • Can you check Thomas comment please? that's what I need. thanks – Arash Jul 17 '12 at 09:30
1

If I understand correctly, you are in a situation where multiple people share the same account on a computer -- that is, not only will they run the same emacs binary, they also have the same home directory where Emacs searches for the .emacs file.

It seems like you not only want to prevent others from reading the .emacs file, you actually don't want them to be able to run emacs at all.

Unfortunately for you, Emacs can be started with -q or -Q in which case the .emacs file is not evaluated at all. Thus any "protection" that relies on your .emacs file can easily be circumvented.

How about restricting access to the emacs binary instead? Maybe make it only executable for members of a certain Unix group (which of course is pointless if multiple people share the same account), or something along those lines. But note that this will not prevent them from installing their own local copy of Emacs.

Thomas
  • 17,016
  • 4
  • 46
  • 70