LoginSignup
0
0

More than 3 years have passed since last update.

Raspberry 3B+ + Ubuntu Mate 18.04 環境へMacからリモート接続

Posted at

環境

Raspberry 3B+, Ubuntu Make 18.04
MacとRaspberryPiは自宅のWifiルータに接続する。(同じネットワークに所属している状態を前提)

Raspberry 3B+にてopenssh-serverをインストール

sudo apt update
sudo apt upgrade
sudo apt install openssh-server

Macからリモート接続

ipアドレス:192.168.2.100
ユーザ名:ubuntu, パスワード: ubuntu とする

$ ssh ubuntu@192.168.2.100
ubuntu@192.168.2.100's password:(パスワードを入力)

パスワード入力後にRaspberrypiにアクセスできればOK

Raspberrypi側のip addressを調べる

# Raspberrypi側で実行
ifconfig | grep -A 5 -n wlan0

エラー対策

port 22: Connection refused

$ ssh ubuntu@192.168.2.100
ssh: connect to host 192.168.2.100 port 22: Connection refused

原因:port 22 がアクセス許可されていない
対策:port 22 をアクセス許可する

sudo ufw allow 22
# sshの再起動
sudo /etc/init.d/ssh restart
# 起動時にsshの起動
sudo systemctl enable ssh

Raspberry PiにUbuntu MATEをインストール + リモート接続

これで解決

エラー対策2

Connection closed

$ ssh ubuntu@192.168.2.100
Connection closed by 192.168.2.100 port 22

原因:SSH keys が何らかの理由で正しくない
対策:openssh-serverをdpkg-reconfigure する

$ sudo dpkg-reconfigure openssh-server

SSH connection closed - resolved

Apparently, the SSH keys (/etc/ssh/ssh*key) on the Raspberry were all of zero size for some reason. To fix that I had to run the following commands from the terminal:

$ sudo rm -r /etc/ssh/ssh*key
$ sudo dpkg-reconfigure openssh-server

After the system regenerated the SSH keys I was able to connect via successfully.

これでやっと繋がった。

参考

SSH connection closed - resolved
Raspberry Piの初期設定
Raspberry PiにUbuntu MATEをインストール + リモート接続

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0