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

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

요약

사용자가 원격 서버에 접속해 로컬 컴퓨터에 정의해둔 프롬프트 명령어를 마치 해당 서버에 설치된 프로그램처럼 실행할 수 있게 해주는 도구가 소개되었습니다. 예를 들어 `promptctl ssh` 명령어를 사용하면 LLM 접근 권한이 있는 로컬 환경에서 프롬프트가 실행되므로, 원격 서버에는 LLM 도구를 설치하거나 SSH 접근 권한을 부여할 필요가 없습니다. 이를 통해 사용자는 보안을 유지하면서 원격 서버의 설정 파일을 분석하거나 코드를 생성하는 등의 작업을 간편한 명령어로 수행할 수 있습니다.

본문

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를 활용하여 작성한 분석입니다. 원문은 출처 링크를 통해 확인할 수 있습니다.

공유

관련 저널 읽기

전체 보기 →