Linux command
mole 命令
网络
需要网络或远程资源。
常用示例
Create a local SSH tunnel
mole start local --source :[local_port] --destination [host]:[port] --server [user]@[ssh_server]
Create a tunnel with verbose output
mole start local --verbose --source :[local_port] --destination [host]:[port] --server [user]@[ssh_server]
Create a tunnel using a specific SSH key
mole start local --source :[local_port] --destination [host]:[port] --server [user]@[ssh_server] --key [~/.ssh/id_rsa]
Save a tunnel as an alias for reuse
mole add alias local [name] --source :[local_port] --destination [host]:[port] --server [user]@[ssh_server]
Start a saved tunnel alias
mole start alias [name]
Show all saved aliases
mole show alias
说明
mole is a CLI application for creating SSH tunnels focused on resiliency and user experience. It forwards local ports to remote addresses through SSH servers, supports multiple tunnels over a single connection, and leverages SSH config file settings. Subcommands include start (start a tunnel or alias), add (save a tunnel alias), delete (remove an alias), show (display alias details), stop (stop a running tunnel), and version. Mole keeps idle connections alive with synthetic packets and automatically reconnects if the SSH connection drops. Tunnel configurations can be saved as aliases for quick reuse.
参数
- --source _HOST:PORT_
- Local address and port to listen on. Auto-selected if not specified.
- --destination _HOST:PORT_
- Remote destination to forward to.
- --server _USER@HOST:PORT_
- SSH server to tunnel through.
- --key _path_
- Path to the SSH private key file.
- --verbose
- Enable verbose logging output.
- --detach
- Run mole in the background.
- --insecure
- Skip SSH host key validation.
- --connection-retries _N_
- Number of reconnection attempts if the SSH connection drops.
- --retry-wait _duration_
- Time to wait between reconnection attempts.
FAQ
What is the mole command used for?
mole is a CLI application for creating SSH tunnels focused on resiliency and user experience. It forwards local ports to remote addresses through SSH servers, supports multiple tunnels over a single connection, and leverages SSH config file settings. Subcommands include start (start a tunnel or alias), add (save a tunnel alias), delete (remove an alias), show (display alias details), stop (stop a running tunnel), and version. Mole keeps idle connections alive with synthetic packets and automatically reconnects if the SSH connection drops. Tunnel configurations can be saved as aliases for quick reuse.
How do I run a basic mole example?
Run `mole start local --source :[local_port] --destination [host]:[port] --server [user]@[ssh_server]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --source _HOST:PORT_ do in mole?
Local address and port to listen on. Auto-selected if not specified.