HN 표시: SSH 원격 셸에서 로컬 프롬프트 실행

hackernews | | 💼 비즈니스
#ssh #tip #로컬프롬프트 #원격셸 #통합 #팁
원문 출처: hackernews · Genesis Park에서 요약 및 분석

요약

'promptctl ssh' 명령어를 사용하면 로컬에서 정의한 LLM 프롬프트를 마치 원격 서버의 실행 프로그램인 것처럼 불러와 사용할 수 있습니다. 사용자는 원격 호스트에서 `llm-analyze-config`와 같은 명령어를 입력하면, 실제 연산은 선택한 LLM을 통해 내 컴퓨터에서 이루어집니다. 이 방식은 서버에 별도의 설치가 필요 없거나 인터넷 연결 없이도 LLM 도구를 안전하게 활용할 수 있어 보안성을 높여줍니다.

본문

Appearance SSH Remote Integration The SSH integration enables you to bring your prompts and execute them on a remote server via SSH. In interactive mode, your prompts become available in your remote shell session, executable exactly like on your computer. Non Interactive Mode When executing a prompt, you can change the "execution context" to become that of a remote SSH server. shell log_analyzer --ssh-dest user@remote_host This tells remote-capable helpers to execute on the indicated server rather than on your local machine. For instance if the prompt file of log_analyzer looks like: then executing the prompt with --ssh-dest would fetch and render /var/log/nginx.conf from the specified server. Without --ssh-dest , it would be read locally. Interactive Mode Interactive mode allows you to SSH into a server, and execute your enabled prompts on that server directly inside the remote shell, exactly like how you would do on your local machine. Simply prepend promptctl to your usual ssh command while creating the connection: shell $ promptctl ssh -p 2222 [email protected] # enabled prompts available on server [email protected]:~# log_analyzer --help Under the hood, promptctl just executes your system's SSH binary, thus you may pass all your usual SSH arguments, or define them in ~/.ssh/config as always. This creates a thin, session-bound mapping of remote shell functions to your prompts, and a channel for communicating with your local promptcmd instance. INFO In both interactive and non-interactive modes, neither your API keys nor your prompts files are transferred to the remote host. Prompt execution still takes place locally. Channels The remote shell communicates with the locally running promptctl for executing prompts via a channel that gets established over the SSH connection. You can choose from several channel types. TIP Normally you should not need to change default channel, unless in an unlikely scenario that a target server is not compatible with default one. | Channel | Communication Over | Server Requirements | |---|---|---| | fifo | named Pipes in a multiplexed SSH connection | Ability to execute mkfifo | | nc | remote forwarded port | TCP forwarding enabled in sshd, nc in path | | socat | remote forwarded unix socket | TCP forwarding enabled in sshd, socat in path | | bashtcp | remote forwarded port | TCP forwarding enabled in sshd, bash | Configuration In your config you can customize the integration for each server. While establishing the SSH connection, the specified username and server are used in finding the closest matching configuration. toml # Global, for all ssh hosts [[ssh]] # Display Message of the Day if not disabled by remote user motd = false # Communication Channel between remote and local channel = "fifo" # Remote shell. Leave default for auto detection. shell = "auto" # Define multiple times for different hosts [[ssh]] host = "proxmox.lan" shell = "bash" # or for a specific user on a host [[ssh]] host = "proxmox.lan" user = "root" channel = "nc" See config sample for full reference. Limitations The are some limitations that are still currently being worked on:

Genesis Park 편집팀이 AI를 활용하여 작성한 분석입니다. 원문은 출처 링크를 통해 확인할 수 있습니다.

공유

관련 저널 읽기

전체 보기 →