My_Play_Lists ~BlackCatWhiteTail’s blog~

Talk About My Favorite Songs

MacのホストOSからVirtualBox上のゲストOSであるLubuntuに対してssh接続する(SSH connecting from the host OS on Mac to the guest OS, Lubuntu, running on VirtualBox)

 はじめに

 VirtualBox上のゲストOSへ、ホストOSのMacからssh接続する方法について調べた。  web上では情報が錯綜しているため、ChatGPTを用いて動作を確認した。

 環境

macOS; 12.6.8 VirtualBox; 7.0.8 r156879 ubuntu; 22.04.3

 方法

(1)VirtualBoxの設定(ぽートフォワーディングを使用する)

  1. VirtualBox のメインウィンドウで、対象の VM を選択して「設定」をクリックする。

  2. 左側のメニューから「ネットワーク」を選択する。

  3. 「アダプター1」タブ (または SSH を使用する予定のアダプター) を確認し、接続方法が「NAT」に設定されていることを確認する。

  4. 「詳細」を展開し、「ポートフォワーディング」ボタンをクリックする。

  5. ポートフォワーディングルールウィンドウで、右側の緑の「+」ボタンをクリックして新しいルールを追加する。

  6. 以下の情報を入力または確認する:

   - **名前**: 任意の名前 (例: "SSH")
   - **プロトコル**: TCP
   - **ホストIP**: 通常は空白のまま
   - **ホストポート**: 2222 (またはホストで使用したい他のポート)
   - **ゲストIP**: 通常は空白のまま
   - **ゲストポート**: 22 (SSHのデフォルトポート)
  1. 「OK」をクリックしてルールを保存し、再び「OK」をクリックして設定を閉じる。

(2)ssh接続する  Macのターミナルを開く以下のコマンドを実行する。

ssh -p 2222 [ゲストマシンのユーザー名]@127.0.0.1 
(注意:小文字のp)

or

ssh -p 2222 [ゲストマシンのユーザー名]@localhost

Introduction

 I investigated how to make an ssh connection to a guest OS on VirtualBox from a Mac on the host OS.  Since information on the web is mixed, I confirmed the operation using ChatGPT.

Environment

macOS; 12.6.8 VirtualBox; 7.0.8 r156879 ubuntu; 22.04.3

Method

(1) VirtualBox configuration (using pote forwarding)

  1. in the main window of VirtualBox, select the target VM and click "Settings". 2.

  2. Select "Network" from the menu on the left side. 3.

Check the "Adapter 1" tab (or the adapter you plan to use SSH with) and make sure the connection method is set to "NAT". 4.

Expand "Advanced" and click the "Port Forwarding" button. 5.

In the Port Forwarding Rules window, click the green "+" button on the right to add a new rule. 6.

   - **Name**: any name (e.g., "SSH")
   - **Protocol**: TCP
   - **Host IP**: Normally left blank
   - **Host Port**: 2222 (or any other port you wish to use on your host)
   - **Guest IP**: usually left blank
   - **Guest Port**: 22 (default port for SSH)
  1. Click "OK" to save the rule and "OK" again to close the configuration.

(2) Make an ssh connection  Run the following command that opens a terminal on your Mac.

ssh -p 2222 [guest machine user name]@127.0.0.1 
(Note: lower case p)

OR

ssh -p 2222 [guest machine username]@localhost

 このウェブサイトについて

 練習用のサイトです.

 自分の好きな曲について感想を述べます.

 また,世に役に立つかもと考えたことも書きます.

 

TOP 1 To 5

Title Artist Album
ロックバンド 中村中 私を抱いて下さい
犬の生活 SEX MACHINEGUNS SEX MACHINEGUNS
Megalovania Toby Fox UNDERTALE Soundtrack
Bokura No Fly Away Base Ball Bear Bokura No Fly Away - single
人魚の檻 陰陽座 迦陵頻伽(Ka Ryo Bin Ga