LoginSignup
0
0

VscodeでSSHを使用してVirtualboxのゲストOSに接続

Posted at

基本は下にあるサイトの通りにやれば問題ない。

詰まった部分があったのでメモとして残す

ゲストOSにopenssh-serverがあるか確認する

ないならインストール
$sudo dnf install openssh-server

ポート番号の指定

本来sshはポート番号22だけどVirtuallboxでポートフォワーディングで経由する必要があるため
ポートフォワーディングの設定でホスト2222 ゲスト22としてあげる。

configの設定
Host linux
HostName localhost
User root
Port 2222

SSH 経由の root ログインの有効化

ゲストOS側でのroot権限でログインしたいときは設定を変更する必要がある

$ vi /etc/ssh/sshd_config でファイルを見ると

#Authentication:
#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

PermitRootLoginという部分がある。最初はコメントアウトをしているため解除をしてyesを追記

そして再起動
$service sshd restart

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