SSH coonection to raspberry pi not working
4 ビュー (過去 30 日間)
古いコメントを表示
I have raspberry pi with ssh enabled and i am able to connect to it through my terminal but matlab is not able to connect to it

Here is ssh log on the pi
sudo journalctl -u ssh.service -n 80
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: permanently_set_uid: 103/65534 [preauth]
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: list_hostkey_types: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25>
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: SSH2_MSG_KEXINIT sent [preauth]
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: SSH2_MSG_KEXINIT received [preauth]
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: kex: algorithm: curve25519-sha256 [preauth]
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: kex: host key algorithm: ecdsa-sha2-nistp256 [preauth]
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: kex: client->server cipher: aes256-ctr MAC: hmac-sha2-256 compression: none [preau>
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: kex: server->client cipher: aes256-ctr MAC: hmac-sha2-256 compression: none [preau>
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth]
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: SSH2_MSG_KEX_ECDH_INIT received [preauth]
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: rekey out after 4294967296 blocks [preauth]
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: SSH2_MSG_NEWKEYS sent [preauth]
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: Sending SSH2_MSG_EXT_INFO [preauth]
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: expecting SSH2_MSG_NEWKEYS [preauth]
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: SSH2_MSG_NEWKEYS received [preauth]
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: rekey in after 4294967296 blocks [preauth]
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: KEX done [preauth]
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: userauth-request for user gurkirat service ssh-connection method password [preauth]
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: attempt 0 failures 0 [preauth]
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: PAM: initializing for "gurkirat"
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: PAM: setting PAM_RHOST to "192.168.1.100"
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: PAM: setting PAM_TTY to "ssh"
Dec 31 22:12:39 raspberrypi sshd[8379]: Failed none for gurkirat from 192.168.1.100 port 56742 ssh2
Dec 31 22:12:39 raspberrypi sshd[8379]: Connection closed by authenticating user gurkirat 192.168.1.100 port 56742 [preauth]
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: do_cleanup [preauth]
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: monitor_read_log: child log fd closed
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: do_cleanup
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: PAM: cleanup
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: Killing privsep child 8380
Dec 31 22:12:39 raspberrypi sshd[8379]: debug1: audit_event: unhandled event 12
Dec 31 22:14:52 raspberrypi systemd[1]: Stopping ssh.service - OpenBSD Secure Shell server...
Dec 31 22:14:52 raspberrypi systemd[1]: ssh.service: Deactivated successfully.
Dec 31 22:14:52 raspberrypi systemd[1]: Stopped ssh.service - OpenBSD Secure Shell server.
Dec 31 22:14:52 raspberrypi systemd[1]: Starting ssh.service - OpenBSD Secure Shell server...
Dec 31 22:14:52 raspberrypi sshd[8563]: debug1: Set /proc/self/oom_score_adj from 0 to -1000
Dec 31 22:14:52 raspberrypi sshd[8563]: debug1: Bind to port 22 on 0.0.0.0.
Dec 31 22:14:52 raspberrypi systemd[1]: Started ssh.service - OpenBSD Secure Shell server.
Dec 31 22:14:52 raspberrypi sshd[8563]: Server listening on 0.0.0.0 port 22.
Dec 31 22:14:52 raspberrypi sshd[8563]: debug1: Bind to port 22 on ::.
Dec 31 22:14:52 raspberrypi sshd[8563]: Server listening on :: port 22.
Dec 31 22:15:01 raspberrypi sshd[8563]: debug1: Forked child 8615.
Dec 31 22:15:01 raspberrypi sshd[8615]: debug1: Set /proc/self/oom_score_adj to 0
Dec 31 22:15:01 raspberrypi sshd[8615]: debug1: rexec start in 5 out 5 newsock 5 pipe 7 sock 8
Dec 31 22:15:02 raspberrypi sshd[8615]: debug1: inetd sockets after dupping: 4, 4
Dec 31 22:15:02 raspberrypi sshd[8615]: Connection from 192.168.1.100 port 34724 on 192.168.1.50 port 22 rdomain ""
Dec 31 22:15:02 raspberrypi sshd[8615]: debug1: Local version string SSH-2.0-OpenSSH_9.2p1 -2+deb12u3
Dec 31 22:15:02 raspberrypi sshd[8615]: debug1: Remote protocol version 2.0, remote software version libssh2_1.11.0
Dec 31 22:15:02 raspberrypi sshd[8615]: debug1: compat_banner: no match: libssh2_1.11.0
Dec 31 22:15:02 raspberrypi sshd[8615]: debug1: permanently_set_uid: 103/65534 [preauth]
Dec 31 22:15:02 raspberrypi sshd[8615]: debug1: list_hostkey_types: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25>
Dec 31 22:15:02 raspberrypi sshd[8615]: debug1: SSH2_MSG_KEXINIT sent [preauth]
Dec 31 22:15:02 raspberrypi sshd[8615]: debug1: SSH2_MSG_KEXINIT received [preauth]
Dec 31 22:15:02 raspberrypi sshd[8615]: debug1: kex: algorithm: curve25519-sha256 [preauth]
Dec 31 22:15:02 raspberrypi sshd[8615]: debug1: kex: host key algorithm: ecdsa-sha2-nistp256 [preauth]
Dec 31 22:15:02 raspberrypi sshd[8615]: debug1: kex: client->server cipher: aes256-ctr MAC: hmac-sha2-256 compression: none [preau>
Dec 31 22:15:02 raspberrypi sshd[8615]: debug1: kex: server->client cipher: aes256-ctr MAC: hmac-sha2-256 compression: none [preau>
Dec 31 22:15:02 raspberrypi sshd[8615]: debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth]
Dec 31 22:15:02 raspberrypi sshd[8615]: debug1: SSH2_MSG_KEX_ECDH_INIT received [preauth]
Dec 31 22:15:02 raspberrypi sshd[8615]: debug1: rekey out after 4294967296 blocks [preauth]
0 件のコメント
回答 (1 件)
praguna manvi
2025 年 1 月 2 日
編集済み: praguna manvi
2025 年 1 月 2 日
As I see, you are unable to connect to the Raspberry Pi configured through SSH from MATLAB. Here is a set of debugging steps that can be followed:
The debug log indicates "Failed none for gurkirat..." which could mean that the SSH server is not accepting the authentication method being used, where the password is not being passed from the client. Refer to this useful discussion thread below, which mentions that the error could be resolved by setting "PasswordAuthentication" to "yes" in "/etc/ssh/sshd_config":
Connect using "raspi" directly, which might provide more specific informatation on errors. Refer to the documentation below for more details:
Also, check whether SSH connections are allowed by the device's firewall at the specific port (22).
Hope this helps!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で MATLAB Support Package for Raspberry Pi Hardware についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!