Support SSH aliases in Dosh client installs
ci / test (push) Has been cancelled
ci / remote-bench (push) Has been cancelled

This commit is contained in:
Codex
2026-06-11 08:46:24 -04:00
parent 6cfba5329d
commit 12beb04d4d
6 changed files with 19 additions and 17 deletions
+8 -9
View File
@@ -92,37 +92,36 @@ dosh-client
Default UDP port: `50000`. This is intentionally inside the common forwarded range
`50000-52000/udp`.
Put this repo on your Gitea server, then install on each Linux server you want to
attach to:
Install on each Linux server you want to attach to:
```bash
curl -fsSL https://gitea.example.com/you/dosh/raw/branch/main/install.sh \
| DOSH_REPO=https://gitea.example.com/you/dosh.git DOSH_PORT=50000 sh -s -- server
curl -fsSL https://git.palav.dev/Palav/dosh/raw/branch/main/install.sh \
| DOSH_REPO=https://git.palav.dev/Palav/dosh.git DOSH_PORT=50000 sh -s -- server
```
Install the client on macOS:
```bash
curl -fsSL https://gitea.example.com/you/dosh/raw/branch/main/install.sh \
| DOSH_REPO=https://gitea.example.com/you/dosh.git DOSH_SERVER=user@host DOSH_PORT=50000 sh -s -- client
curl -fsSL https://git.palav.dev/Palav/dosh/raw/branch/main/install.sh \
| DOSH_REPO=https://git.palav.dev/Palav/dosh.git DOSH_SERVER=palav DOSH_HOST=git.palav.dev DOSH_PORT=50000 sh -s -- client
```
Install the client on Windows PowerShell:
```powershell
$env:DOSH_REPO="https://gitea.example.com/you/dosh.git"; $env:DOSH_SERVER="user@host"; $env:DOSH_PORT="50000"; irm https://gitea.example.com/you/dosh/raw/branch/main/install.ps1 | iex
$env:DOSH_REPO="https://git.palav.dev/Palav/dosh.git"; $env:DOSH_SERVER="palav"; $env:DOSH_HOST="git.palav.dev"; $env:DOSH_PORT="50000"; irm https://git.palav.dev/Palav/dosh/raw/branch/main/install.ps1 | iex
```
Attach:
```bash
dosh-client user@host
dosh palav
```
Use named sessions:
```bash
dosh-client --session work user@host
dosh --session work palav
```
Press `Ctrl-]` to detach the current client while leaving the server session alive.
+1 -1
View File
@@ -454,7 +454,7 @@ Client config: `~/.config/dosh/client.toml`
```toml
server = "user@example.com"
ssh_port = 22
# ssh_port = 22
dosh_port = 50000
default_session = "default"
reconnect_timeout_secs = 5
+1 -1
View File
@@ -51,7 +51,7 @@ try {
@"
server = "$defaultServer"
$doshHostLine
ssh_port = 22
# ssh_port = 22
dosh_port = $Port
default_session = "default"
reconnect_timeout_secs = 5
+1 -1
View File
@@ -183,7 +183,7 @@ if [ "$role" = "client" ] || [ "$role" = "both" ]; then
cat >"$client_config" <<EOF
server = "$default_server"
$dosh_host_line
ssh_port = 22
# ssh_port = 22
dosh_port = $port
default_session = "default"
reconnect_timeout_secs = 5
+6 -3
View File
@@ -80,7 +80,7 @@ async fn main() -> Result<()> {
"read-write"
}
.to_string();
let ssh_port = args.ssh_port.unwrap_or(config.ssh_port);
let ssh_port = args.ssh_port.or(config.ssh_port);
let dosh_port = args.dosh_port.unwrap_or(config.dosh_port);
let cache_path = cache_path(&config.credential_cache, &server, &session, &mode);
let (cols, rows) = size().unwrap_or((80, 24));
@@ -232,7 +232,7 @@ fn local_bootstrap(
fn ssh_bootstrap(
server: &str,
ssh_port: u16,
ssh_port: Option<u16>,
ssh_auth_command: &str,
ssh_key: Option<&std::path::Path>,
ssh_known_hosts: Option<&std::path::Path>,
@@ -246,7 +246,10 @@ fn ssh_bootstrap(
let nonce_b64 = URL_SAFE_NO_PAD.encode(nonce);
let size = format!("{cols}x{rows}");
let mut command = Command::new("ssh");
command.arg("-p").arg(ssh_port.to_string()).arg("-T");
if let Some(ssh_port) = ssh_port {
command.arg("-p").arg(ssh_port.to_string());
}
command.arg("-T");
if let Some(key) = ssh_key {
command.arg("-i").arg(key);
}
+2 -2
View File
@@ -46,7 +46,7 @@ impl Default for ServerConfig {
pub struct ClientConfig {
pub server: String,
pub dosh_host: Option<String>,
pub ssh_port: u16,
pub ssh_port: Option<u16>,
pub dosh_port: u16,
pub default_session: String,
pub reconnect_timeout_secs: u64,
@@ -60,7 +60,7 @@ impl Default for ClientConfig {
Self {
server: "user@example.com".to_string(),
dosh_host: None,
ssh_port: 22,
ssh_port: None,
dosh_port: 50000,
default_session: "default".to_string(),
reconnect_timeout_secs: 5,