Mac上でVSCodeを使用して大学のmuseに接続する
VSCodeを利用したssh-remoteでの学内サーバー接続
公開鍵認証を利用することでパスワードが不要になる
パスワードでの利用は今の所不可.
VSCodeのインストール
https://code.visualstudio.com/ にアクセス
ダウンロードして手順に従ってインストール
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
インストールが終了して起動するとこんな画面になる
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
鍵の生成,公開鍵認証の準備
鍵を生成することでパスワード認証をスキップしてサーバにアクセスできる
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
大学のサーバに設置する鍵を公開鍵,自分で持つ方を秘密鍵と呼ぶ.秘密鍵は絶対に公開してはならない.公開鍵/秘密鍵は自分を証明するために必要な鍵であり,自分宛ての通信を暗号化する際にも有用なので公開してはならない(公開鍵で暗号化したものは秘密鍵でのみ復号化できるため).
作業の順番は,
- 公開鍵と秘密鍵のセットを作る
- 公開鍵認証の準備をする
- 公開鍵を大学のサーバに転送する
.ssh/authorized_keys
に中身を書き込む
- 読み取り権限を設定する
鍵ペアの作成
ターミナル(Windowsならコマンドライン)を開いて$ ssh-keygen
を実行して鍵ペアを作成する
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
これを行うことで鍵ペアを作成できる.
何も設定しない状態だと~/.ssh
内に秘密鍵のファイル:id_rsa
,と公開鍵のファイル:id_rsa.pub
の2つのファイルが作成される.この内id_rsa.pub
を大学のサーバに置く必要がある.
[学外NWからの場合]学内NWへのVPN接続
以降の手順では大学のサーバに接続する.学外からの接続の場合はVPN接続が必要.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
MyWasedaのITサービスタブ,左の ヘルプデスク > マニュアル等 > ネットワークサービス > VPN利用による学内ネットワーク接続
のマニュアルに従って学内に接続する
公開鍵の転送
まず公開鍵(~/.ssh/id_rsa.pub
)を学内サーバーのホームディレクトリ(~/
)に転送する.以降では学籍番号が1x12345-8
の場合について解説する
VSCodeの設定
拡張機能:Remote Developmentのインストール
マーケットプレイスを開いてRemote Development
を検索してインストール
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
インストールが成功すると左下に緑色のリモート接続マークが出現する.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
sshのコンフィグの作成
左下のリモート接続アイコンを押して,
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Remote-SSH: Open Configuration File
をクリック.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
特になければユーザーのconfigファイルを開く
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
設定画面が出てきたら以下の内容を書き込み,保存する.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
ログインIDは人によって異なり,秘密鍵のディレクトリも場合によっては異なる.接続先の表示名は任意に変更しても良い.ここではschool_vscode
とした.
大学サーバへの接続
上手くいかない場合は下記の.wgetrcの記述を試してください
リモートSSHのアイコン(画面に><
)マークをクリックし(①),school_vscodeを右クリックしたら(②),Connect to Host in current Window
を選択する.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
秘密鍵に対してパスフレーズを設定している場合はここで入力欄が出てくる.
フォルダを開くためには,ファイルアイコンをクリックして(①),Open Folder
をクリックする(②).
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
選択のポップアップが出てくるので,そのままOK
を押す.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
リモートの環境を開くことができた.

.wgetrcの記述
初期設定ファイルをインターネットから取得する際に,学内のサーバから接続するとうまくいかない場合があります.その場合はホームディレクトリに.wgetrcというファイルを作成して,以下を記述してください.
使用方法
ネットで検索してください.
マケプレでC/C++の拡張機能を入れたり,Javaの拡張機能を入れたり,Pythonの拡張機能を検索して入れたりするといいと思います.