2

I'm working on a project which includes rabbit. The issue is that when installing the project, the application takes care of copying the .erlang.cookie from C:\Windows\system32\config\systemprofile\ to C:\Users\pc and when my program does it, the hash does not match and I can't create users by command line, but when I copy it manually it does. Has anyone else experienced something similar? Thank you so much.

The sentence that use the program to copy the cookie:

copy C:\Windows\system32\config\systemprofile\.erlang.cookie %UserProfile%\.erlang.cookie

I have tried creating a .bat file and having my program execute it, or having my program execute the command directly using the WinExec and ShellExecute statements, nothing has worked.

Jan Doggen
  • 8,799
  • 13
  • 70
  • 144
V1rtual
  • 21
  • 4
  • To clarify: is %UserProfile% is the profile folder of the user who wants to manage RabbitMQ users? – mjn Jul 24 '23 at 09:04
  • @mjn Yeah, the absolute path in this case is: C:\Users\pc – V1rtual Jul 24 '23 at 09:12
  • Did you compare the copied files? (compare the non-working and the working cookie file) – mjn Jul 24 '23 at 09:21
  • @mjn The file from C:\Windows\system32\config\systemprofile\ and the working copy has the same text inside: WGBYRAWYWPCMGQUIFASB, but the non-working copy has another different: QMAWQCZPESEXZWDWAAEG. I don't know why making a copy can change its content. – V1rtual Jul 24 '23 at 09:34
  • Have you tried the `rabbitmq-diagnostics erlang_cookie_sources` command as described in https://www.rabbitmq.com/cli.html#cookie-file-troubleshooting? – mjn Jul 24 '23 at 10:09
  • @mjn Yeah, the only noticeable difference is that the effective user appears as (none). Also trying to manually edit the cookie to give it the value of the original cookie using this command: **type C:\Windows\system32\config\systemprofile\.erlang.cookie >> %UserProfile%\.erlang.txt** The cookie appears with no value when I run it from the program but it does appear with the correct value if I run it myself – V1rtual Jul 24 '23 at 10:42
  • My guess is that your program does not have the correct access privileges to the `C:\Windows\system32\config\systemprofile\.erlang.cookie` file when it is run. Does your program check the exit code of the `copy` statement? – Luke Bakken Jul 25 '23 at 17:18

0 Answers0