IT관련/CentOS7

centos7에서 ssh를 통해 mysql 연결시 에러

파란하늘999 2025. 7. 2. 14:07

갑자기 아래 에러가 발생.

Error: Connection lost: The server closed the connection.
    at Channel.<anonymous> (/home/testuser/test/node_modules/mysql2/lib/base/connection.js:113:31)
    at Channel.emit (node:events:525:35)
    at Channel.emit (node:domain:489:12)
    at doClose (/home/testuser/test/node_modules/ssh2/lib/utils.js:91:33)
    at onCHANNEL_CLOSE (/home/testuser/test/node_modules/ssh2/lib/utils.js:108:7)
    at CHANNEL_CLOSE (/home/testuser/test/node_modules/ssh2/lib/client.js:703:11)
    at 97 (/home/testuser/test/node_modules/ssh2/lib/protocol/handlers.misc.js:999:16)
    at Protocol.onPayload (/home/testuser/test/node_modules/ssh2/lib/protocol/Protocol.js:2059:10)
    at AESGCMDecipherNative.decrypt (/home/testuser/test/node_modules/ssh2/lib/protocol/crypto.js:987:26)
    at Protocol.parsePacket [as _parse] (/home/testuser/test/node_modules/ssh2/lib/protocol/Protocol.js:2028:25) {
  fatal: true,
  code: 'PROTOCOL_CONNECTION_LOST'
}

 

 

해결방법

 

1.콘솔에서 ssh 연결했더니 에러가 발생.

Permissions 0777 for '/Users/username/.ssh/id_rsa' are too open.

 

2.모드변경

     chmod 400 id_rsa 

 

3.mysql 연결했더니 해결.

 

 

 

참고

https://stackoverflow.com/questions/9270734/ssh-permissions-are-too-open

 

윈도우에서의 오류 참고사이트

https://rainbound.tistory.com/entry/%EC%9C%88%EB%8F%84%EC%9A%B0-ssh-%EC%97%B0%EA%B2%B0-%EC%97%90%EB%9F%ACpermissions-too-open%EB%93%B1

 

윈도우 ssh 연결 에러(permissions ... too open등)

목차 리눅스의 경우 pem 파일을 chmod 400 "파일명" 해주면 됩니다. Permissions... too open 에러 Permissions for '.pem' are too open It is required that your private key files are NOT accessible by others. This private key will be ignored

rainbound.tistory.com

 

반응형

'IT관련 > CentOS7' 카테고리의 다른 글

top 명령어  (1) 2025.07.08