LoginSignup
2
1

More than 3 years have passed since last update.

TermuxでVSCode Remote

Posted at

TermuxとVSCodeとprootとUbuntu

TermuxはAndroidにaptとターミナルをつけてくれるが、仮想環境ではない。libcはbionicだったりする。そのためVSCodeのリモート接続が使えない。

Termux内にUbuntuの仮想環境を入れるにはproot。具体的な方法はいろいろあるらしいが、今回はUbuntu-in-Termuxを使った。

https://github.com/MFDGaming/ubuntu-in-termux

しかし、Ubuntuのsshdがうまくいかない

Ubuntuの仮想環境内でapt install -y openssh-serverして、(Androidが非root端末なら)ポート番号を1024以上にして、sshdを立ち上げれば、Ubuntuの仮想環境のシェルに入れるはず、なのだが入れない。認証は通るが、リモートのシェルとつながらない。原因究明は諦めた。

回避策:Termux側のsshd_configでprootを設定する

$PREFIX/etc/ssh/sshd_configを編集して、以下の1行を末尾に追加する。

ForceCommand /data/data/com.termux/files/home/ubuntu-in-termux/startubuntu.sh

sshdを立ち上げ直せば、VSCodeのリモート接続はUbuntuの仮想環境とつながる。

2
1
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
2
1