Remsh Cookie Format: Connection attempt from disallowed node

I’m trying to connect to a remote node but the request keeps getting rejected. The error is: “Connection attempt from disallowed node”. I understand this means the cookie is invalid, i.e. doesn’t match the running node.

When I SSH to the remote machine and run cat vm.args I see:

## Name of the node
-name myapp@

## Cookie for distributed erlang
-setcookie JGpXR9PPNYgMLhMii#3VktVMUAb7dRU3G3VdLsLYXk6t

When I start a session on the remote machine, this cookie shows up as:

$: iex sname will --cookie JGpXR9PPNYgMLhMii#3VktVMUAb7dRU3G3VdLsLYXk6t
Interactive Elixir (1.5.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(will@iex_test)1> :erlang.get_cookie()

No matter how I tried to represent the cookie I get this error: {cookie}, '{cookie}', "{cookie}", :"{cookie}".

I’m deploying the application inside a Docker container. My cookie is exported as an environment variable and I’m wondering if it’s getting set in a different format when grabbed by System.get_env("COOKIE") in the Docker container than when it’s set from the shell.

bump :slight_smile:

Are you trying to connect remotely, or are you connecting locally over SSH? Remotely is not allowed since it is in this specific example.

1 Like

I’m SSHing into the machine that is running the node and connecting from there.

-args_file FileName

[…] A comment begins with a # character and continues until the next end of line character. Backslash (\) is used as quoting character. […]

(emphasis mine)

Please try:

## Cookie for distributed erlang
-setcookie JGpXR9PPNYgMLhMii\#3VktVMUAb7dRU3G3VdLsLYXk6t

Alternatively: Avoid the usage of # and use another cookie :slight_smile:


Wow. Yes, my cookie was truncated to the value before the #. I was able to connect just using the value up to that character.