Manage SSH hosts in SQLite and connect via ssh
Project description
sshctl
一个小而干净的 CLI 工具:用 SQLite 管理你的 SSH 服务器别名(name),并支持 ~/.ssh/config 解析与合并。
安装
本地开发安装:
pip install -e .
使用
帮助/查询命令
- 总帮助:
sshctl -h
# 或
sshctl help
- 查询某个子命令怎么用:
sshctl help add
sshctl help ssh
sshctl help edit
1) 初始化数据库
默认数据库路径:~/.local/share/sshctl/servers.db
sshctl init
2) 添加服务器
普通方式(参数式):
sshctl add --name hk1 --host 1.2.3.4 --user root --port 22 --identity-file ~/.ssh/id_rsa
交互式向导(按提示一步步输入,更省脑子):
sshctl add --wizard
3) 列出服务器
sshctl list
4) 连接服务器(优先使用 ~/.ssh/config 的 Host 定义)
- 若
name在~/.ssh/config中存在对应Host,会直接执行:ssh <name>(最符合你的习惯,也自动继承 ProxyJump/IdentityFile 等配置) - 否则回退到数据库中拼装命令:
ssh -p <port> -i <identity_file> user@host
指定 name 连接:
sshctl ssh hk1
懒人模式(不传 name,会先列出数据库里的服务器,然后提示你输入要连接的 name;也可以输入 ~/.ssh/config 里的 Host):
sshctl ssh
5) 编辑/删除
参数式:
sshctl edit hk1 --port 2222
sshctl del hk1
交互式向导:
sshctl edit hk1 --wizard
6) 搜索
sshctl search hk
设计说明
- 主键仍然是 id,但用户侧一律按
name操作(并对name做 UNIQUE)。 - SSH 执行不使用
shell=True,避免注入风险。 - 数据库访问与 CLI 解耦,便于后续扩展(标签/环境/分组/跳板等)。
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
sshctl-0.1.0-py3-none-any.whl
(10.1 kB
view details)
File details
Details for the file sshctl-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sshctl-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
977afc153b25d6eddc1b5431af63c0729cdebc7879d3f27221fb26f183da21f3
|
|
| MD5 |
3acbeaafad919ce074ba6641876a015b
|
|
| BLAKE2b-256 |
7ffd6336a7ab6d91eaf29a17086defe072b31af6062a7a3c586711d876ca7b12
|