[erlang-questions] Using a different cookie path

Michael Santos <>
Wed Jun 29 13:53:53 CEST 2011


On Wed, Jun 29, 2011 at 11:04:04AM +0000, Lionel Cons wrote:
> I would like to control which cookie Erlang will use. In my
> environment, it's not practical to let Erlang use ~/.erlang.cookie.
> 
> I've found the -setcookie option for erl but this takes the cookie
> itself, not a file path. This is insecure since any user could list
> the Unix processes and see the cookie on the command line.

Erlang cookie auth really isn't secure anyway.

> Is there a way to tell Erlang to get its cookie from a file other than
> ~/.erlang.cookie?

    {ok, Cookie} = file:read_file("/path/to/cookie"),
    erlang:set_cookie(binary_to_atom(Cookie, latin1)).

> Thanks in adavnce for your advices,
> 
> Lionel



More information about the erlang-questions mailing list