![원격 서버에서 실행되는 편집기를 사용하여 로컬 파일을 여는 방법](https://linux55.com/image/180698/%EC%9B%90%EA%B2%A9%20%EC%84%9C%EB%B2%84%EC%97%90%EC%84%9C%20%EC%8B%A4%ED%96%89%EB%90%98%EB%8A%94%20%ED%8E%B8%EC%A7%91%EA%B8%B0%EB%A5%BC%20%EC%82%AC%EC%9A%A9%ED%95%98%EC%97%AC%20%EB%A1%9C%EC%BB%AC%20%ED%8C%8C%EC%9D%BC%EC%9D%84%20%EC%97%AC%EB%8A%94%20%EB%B0%A9%EB%B2%95.png)
다음과 같은 원격 서버에서 프로그램을 실행할 수 있습니다.
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
답변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.