リモートサーバー上で実行されているエディターでローカルファイルを開く方法

リモートサーバー上で実行されているエディターでローカルファイルを開く方法

リモートサーバー上でプログラムを実行するには、次のようにします。

ssh -Y [email protected] gvim

しかし、gvim はリモート サーバー上のファイルしか表示できません。リモート サーバーからプログラムを実行して、ローカル ファイルで動作させることは可能ですか?

答え1

ローカルマシンでsshが動作している必要があります。

localusername@localmachine: ssh username@server -R 10000:localmachine:22
username@server: cd /var
username@server: sshfs -p 10000 -o idmap=user,nonempty \
                 [email protected]:~/mywwwdevelstuff www

出典https://superuser.com/a/918708/25609

答え2

scpまずローカル ファイルをリモート サーバーに転送します。

もちろん、ローカル システムに gvim をインストールする方がうまくいく可能性があります。

答え3

次のようにしてリモート マシン上でプログラムを実行できます。 ssh -t <user>@<remote host> '<program to execute with full path and arguments>'

     -t      Force pseudo-terminal allocation.  This can be used to execute arbitrary
             screen-based programs on a remote machine, which can be very useful, e.g.
             when implementing menu services.  Multiple -t options force tty allocation,
             even if ssh has no local tty.

関連情報