settings.js 파일에 Node-RED의 설정 정보가 있습니다. 앞 단계에서 만든 비밀 번호 해시를 이용해서 이 파일을 수정합니다.
탐색기에서 C:\사용자\로그인_사용자\.node-red\settings.js파일을 (더블 클릭하지 말고) 선택하여 오른쪽 마우스를 눌러서 편집 메뉴를 선택합니다.
다음과 같은 편집 화면이 나타납니다.
편집기에서 다음 부분을 찾습니다. 이 때 편집기의 윈도우 화면은 크게 하는 것이 편합니다.
// property can be used. See http://nodered.org/docs/security.html for details.
//adminAuth: {
// type: "credentials",
// users: [{
// username: "admin",
// password: "$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN.",
// permissions: "*"
// }]
//},
// To password protect the node-defined HTTP endpoints (httpNodeRoot), or
// the static content (httpStatic), the following properties can be used.
// The pass field is a bcrypt hash of the password.
// See http://nodered.org/docs/security.html#generating-the-password-hash
//httpNodeAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
//httpStaticAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
앞의 내용을 다음과 같이 수정합니다. 명령어 앞의 //를 없애고 두 군데에서 나타나는 password:와 pass: 다음의 비밀 번호 해시는 앞 단계에서 복사해 둔 비밀 번호 해시로 바꿉니다.
// property can be used. See http://nodered.org/docs/security.html for details.
adminAuth: {
type: "credentials",
users: [{
username: "admin",
password: "$2a$08$4lPtYiJ5KuL3UJxshj2i6uSwIDeCZPGBJZlYjRlaSAUC/UHnBvYJW",
permissions: "*"
}]
},
// To password protect the node-defined HTTP endpoints (httpNodeRoot), or
// the static content (httpStatic), the following properties can be used.
// The pass field is a bcrypt hash of the password.
// See http://nodered.org/docs/security.html#generating-the-password-hash
httpNodeAuth: {user:"user",pass:"$2a$08$4lPtYiJ5KuL3UJxshj2i6uSwIDeCZPGBJZlYjRlaSAUC/UHnBvYJW"},
//httpStaticAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
수정된 파일을 보관합니다.
Node-RED 다시 실행하기
실행중인 Node-RED 명령 프롬프트에서 화면에서 Ctrl+C 키를 누릅니다.
일괄 작업을 끝내시겠습니까? 메시지가 나오면 Y를 입력하여 Node-RED을 끝내고 명령프롬프트 입력 화면으로 돌아옵니다.
또는 Node-RED가 실행중인 터미널 위도우를 닫으면 Node-RED가 종료됩니다.
다시 명령프롬프트에 node-red를 입력하여 Node-RED를 실행합니다.
node-red
만약 윈도우즈 부팅시에 Node-RED가 자동으로 시작된 경우라면 윈도우즈를 다시 부팅하면 됩니다.
Node-RED 로그인하기
이 단계를 거치면 Node-RED 작성기의 사용자 ID는 admin이며 비밀 번호는 gildongcoolguy입니다. Node-RED 대시 보드의 사용자 ID는 user이며 비밀 번호는 gildongcoolguy입니다.
Node-RED 작성기 로그인 화면
Node-RED 대시보드 로그인 화면
여기서는 사용자 ID admin과 user를 사용하고 비밀 번호는 공통으로 gildongcoolguy를 사용하여 설명하였지만, 실제에는 본인의 것으로 바꾸어서 지정하여야 합니다.