ssh
SSH connections, running a command on a server, and working with files over SFTP.
import ssh
This package is an SSH client written in Salam and needs neither OpenSSH nor any other library. Make a Config with the host and the user, pick the login method, and connect with Connect; then run a command with Exec, or move files with SftpOpen. It suits automating deployments, backups and checks across a fleet of servers. It is a client only; for plain file transfer with an FTP server see ftp.
The host key is checked against the known_hosts file, the way ssh itself does. The buffer and reader functions build and read the data format of the SSH protocol; an ordinary program does not need them.
What it supports, and what it does not:
- Keys must be RSA, in the OpenSSH format, without a passphrase. Ed25519 and ECDSA keys, the default of recent
ssh-keygen, are not read. Make a key for automation withssh-keygen -t rsa -b 4096 -N "" -f deploy_key; a password login withWithPasswordalso works. - The server needs an RSA host key; a server that offers only Ed25519 or ECDSA host keys cannot be checked and the connection fails.
- Key exchange is curve25519 or Diffie-Hellman group 14, and the ciphers are
aes128-ctrandaes256-ctr, which every OpenSSH server accepts. There is no agent support and no port forwarding; an interactive shell with a terminal is available throughNewSession,RequestPtyandShell. - Each
Execis a fresh shell: acdor an exported variable does not carry over to the next call.
Run a deployment, step by step
Exec runs one command and waits for it, returning its standard output, its standard error and the exit code in an ExecResult. Each call opens a new channel, so a cd in one command does not carry over to the next; join commands with && when they belong together. A deployment is then a list of steps that stops at the first one whose exit code is not zero.
import ssh
import str
func run_steps(client &: ssh.Client, steps: Vector<str>): bool:
each step in steps:
r := ssh.Exec(client, step)
if not r.ok or r.exit_code != 0:
println "FAILED:", step
println str.Trim(r.stderr)
ret false
end
println "ok:", step
end
ret true
end
func main:
mut cfg := ssh.NewConfig("app1.example.com", ssh.DefaultPort, "deploy")
if not ssh.WithKeyFile(cfg, "/home/deploy/.ssh/id_rsa"):
println "cannot read the key file"
ret 1
end
ssh.WithHostKeyMode(cfg, ssh.HOSTKEY_MODE_STRICT)
mut client := ssh.Connect(cfg)
if not ssh.Ok(client):
println "connect failed:", ssh.Error(client)
ret 1
end
mut steps := Vector {} as Vector<str>
steps.Push("cd /srv/app && git fetch --quiet && git checkout --quiet v2.4.0")
steps.Push("cd /srv/app && ./salam build --release")
steps.Push("sudo systemctl restart app")
steps.Push("systemctl is-active app")
done := run_steps(client, steps)
ssh.Close(client)
if not done:
ret 1
end
ret 0
endThis needs a real server, so it is only checked here. WithKeyFile only reads the file, so it returns false when the path is wrong; a key the package cannot use makes Connect fail instead. For a command that runs for a long time and whose output you want as it comes, such as tail -f, use NewSession, Start and ReadStep with DrainOutput instead, as the example in the reference shows.
Pull a backup over SFTP
SSH and SFTP share one connection: run the command that writes the file with Exec, then open SFTP on the same client and fetch it. Stat gives the size, Download copies the file, and Remove cleans up on the server once the copy has arrived. For whole directories there are UploadDir, DownloadDir and MkdirAll.
import ssh
func main:
mut cfg := ssh.NewConfig("db.example.com", 22, "backup")
_ := ssh.WithKeyFile(cfg, "/home/backup/.ssh/id_rsa")
mut client := ssh.Connect(cfg)
if not ssh.Ok(client):
println "connect failed:", ssh.Error(client)
ret 1
end
remote := "/tmp/shop-backup.sql.gz"
dump := ssh.Exec(client, "pg_dump shop | gzip > " + remote)
if dump.exit_code != 0:
println "pg_dump failed:", dump.stderr
ssh.Close(client)
ret 1
end
mut sftp := ssh.SftpOpen(client)
info := ssh.Stat(client, sftp, remote)
println "dump size on the server:", info.size, "bytes"
if ssh.Download(client, sftp, remote, "shop-backup.sql.gz"):
println "downloaded"
_ := ssh.Remove(client, sftp, remote)
else:
println "download failed:", ssh.Error(client)
end
ssh.SftpClose(client, sftp)
ssh.Close(client)
ret 0
endHost keys and known_hosts
The host key is how the client knows it is talking to the right machine and not to someone in between. The mode decides what happens with a key that is not in known_hosts yet. HOSTKEY_MODE_STRICT refuses it, which is right for automation: add the key once by hand, then every later change is an error you want to hear about. HOSTKEY_MODE_ACCEPT_NEW is the default; it records a new key the first time and refuses a changed one later, like StrictHostKeyChecking=accept-new in OpenSSH. HOSTKEY_MODE_INSECURE checks nothing and belongs only in tests.
import ssh
func attempt(mode: int, label: str):
mut cfg := ssh.NewConfig("new-server.example.com", 22, "admin")
ssh.WithPassword(cfg, "first-login-password")
ssh.WithKnownHostsPath(cfg, "known_hosts")
ssh.WithHostKeyMode(cfg, mode)
mut client := ssh.Connect(cfg)
if ssh.Ok(client):
println label, "connected, host key", ssh.HostKeyFingerprint(client)
ssh.Close(client)
else:
println label, "refused:", ssh.Error(client)
end
end
func main:
attempt(ssh.HOSTKEY_MODE_STRICT, "strict, empty known_hosts:")
attempt(ssh.HOSTKEY_MODE_ACCEPT_NEW, "accept-new, first time:")
attempt(ssh.HOSTKEY_MODE_STRICT, "strict, key now recorded:")
endWith an empty known_hosts the first, strict attempt is refused, the second records the key, and the third, strict again, now connects. HostKeyFingerprint returns the same SHA-256 fingerprint that ssh-keygen -lf prints, so you can compare it with what the server's administrator gave you. The client checks the server's RSA host key (rsa-sha2-256, rsa-sha2-512 or ssh-rsa), so the server needs one; a default OpenSSH install usually has it.
Many hosts from one list
A Config is a plain value, so it is easy to build one per line of an inventory and keep the same rules for all of them: the same user, the same known_hosts file and strict checking. Nothing connects until Connect is called, so the program below runs without a network.
import ssh
import str
import conv
func parse(line: str): ssh.Config:
fields := str.Split(line, " ")
mut port := ssh.DefaultPort
mut host := fields.Get(0)
if str.Contains(host, ":"):
parts := str.Split(host, ":")
host = parts.Get(0)
port = conv.AtoiOr(parts.Get(1), port)
end
mut cfg := ssh.NewConfig(host, port, fields.Get(1))
ssh.WithHostKeyMode(cfg, ssh.HOSTKEY_MODE_STRICT)
ssh.WithKnownHostsPath(cfg, "/etc/deploy/known_hosts")
ret cfg
end
func main:
inventory := "web1.example.com deploy\nweb2.example.com deploy\nbastion.example.com:2222 ops"
each line in str.Split(inventory, "\n"):
cfg := parse(line)
println cfg.user + "@" + cfg.host, "port", cfg.port, "strict:", cfg.hostkey_mode == ssh.HOSTKEY_MODE_STRICT
end
endTo run the same command on all hosts, loop over the configs, connect, Exec and Close. If one host is down, Ok is false for that client and Error says why, and the loop can go on to the next.
Types
Config
struct Config| Name | Type | Description |
|---|---|---|
host | str = "" | The host. |
port | int = 22 | The port; 22 by default. |
user | str = "" | The user name. |
password | str = "" | The password. |
use_password | bool = false | Log in with a password. |
key_pem | str = "" | The private key as text. |
use_key | bool = false | Log in with a key. |
hostkey_mode | int = 1 | The host key check mode. |
known_hosts_path | str = "" | The path of the known_hosts file. |
import ssh
func main:
mut cfg := ssh.NewConfig("example.com", ssh.DefaultPort, "deploy")
println cfg.host, cfg.port, cfg.user, cfg.hostkey_mode == ssh.HOSTKEY_MODE_ACCEPT_NEW
ssh.WithPassword(cfg, "s3cret")
println cfg.use_password, cfg.use_key
ssh.WithKeyPEM(cfg, "-----BEGIN OPENSSH KEY-----")
println cfg.use_key, cfg.key_pem.Len() > 0
println ssh.WithKeyFile(cfg, "/nonexistent/id_rsa")
ssh.WithHostKeyMode(cfg, ssh.HOSTKEY_MODE_STRICT)
ssh.WithKnownHostsPath(cfg, "/home/deploy/.ssh/known_hosts")
println cfg.hostkey_mode, cfg.known_hosts_path
println ssh.HOSTKEY_MODE_INSECURE, ssh.ClientVersion
endSession
struct Session| Name | Type | Description |
|---|---|---|
ch | Channel | The SSH channel. |
ok | bool = false | The session opened. |
import ssh
func main:
mut cfg := ssh.NewConfig("server.example.com", 22, "deploy")
_ := ssh.WithKeyFile(cfg, "/home/deploy/.ssh/id_rsa")
mut client := ssh.Connect(cfg)
if not ssh.Ok(client):
println "error:", ssh.Error(client)
ret
end
println "host key:", ssh.HostKeyFingerprint(client)
r := ssh.Exec(client, "uname -a")
println r.ok, r.exit_code, r.stdout, r.stderr
r2 := ssh.RunCommand(client, "df -h /")
println r2.stdout
mut tail := ssh.NewSession(client)
_ := ssh.RequestPty(tail, client, "xterm", 120, 40)
if ssh.Start(tail, client, "tail -f /var/log/app.log"):
repeat 10:
_ := ssh.ReadStep(tail, client)
print ssh.DrainOutput(tail)
print ssh.DrainStderrOutput(tail)
end
end
ssh.CloseSession(tail, client)
mut shell := ssh.NewSession(client)
if ssh.Shell(shell, client):
_ := ssh.WriteInput(shell, client, "echo hello\nexit\n")
ssh.CloseInput(shell, client)
code := ssh.Wait(shell, client)
println code, ssh.ExitCode(shell), ssh.SessionClosed(shell)
println ssh.Output(shell), ssh.StderrOutput(shell)
end
ssh.CloseSession(shell, client)
probe := ssh.Dial(cfg)
println ssh.Ok(probe)
println ssh.Reconnect(client)
println ssh.SelfTest()
ssh.Close(client)
endExecResult
struct ExecResult| Name | Type | Description |
|---|---|---|
stdout | str = "" | The output. |
stderr | str = "" | The error output. |
exit_code | int = -1 | The exit code. |
ok | bool = false | The command ran. |
The example for this item is shown with the ones above: ssh-Exec.salam
Sftp
struct Sftp| Name | Type | Description |
|---|---|---|
ch | Channel | The channel. |
ok | bool = false | It opened. |
next_id | u32 = 1 | The number of the next request. |
import ssh
func main:
mut cfg := ssh.NewConfig("files.example.com", 22, "ali")
ssh.WithPassword(cfg, "s3cret")
mut client := ssh.Connect(cfg)
mut sftp := ssh.SftpOpen(client)
if not sftp.ok:
println ssh.Error(client)
ret
end
println ssh.MkdirAll(client, sftp, "/backup/2026/09")
println ssh.Upload(client, sftp, "report.pdf", "/backup/2026/09/report.pdf")
println ssh.UploadDir(client, sftp, "site", "/var/www/site")
if ssh.Exists(client, sftp, "/backup/2026/09/report.pdf"):
info := ssh.Stat(client, sftp, "/backup/2026/09/report.pdf")
println info.name, info.size, info.is_dir, info.permissions
end
each info in ssh.ListDir(client, sftp, "/backup"):
println info.name, info.is_dir
end
println ssh.IsLink(client, sftp, "/current"), ssh.Lstat(client, sftp, "/current").name
_ := ssh.Download(client, sftp, "/etc/hostname", "hostname.txt")
_ := ssh.DownloadDir(client, sftp, "/var/log/app", "logs")
_ := ssh.Rename(client, sftp, "/tmp/a", "/tmp/b")
_ := ssh.Remove(client, sftp, "/tmp/b")
_ := ssh.Mkdir(client, sftp, "/tmp/x")
_ := ssh.Rmdir(client, sftp, "/tmp/x")
_ := ssh.RemoveAll(client, sftp, "/tmp/old")
ssh.SftpClose(client, sftp)
ssh.Close(client)
endSftpFileInfo
struct SftpFileInfo| Name | Type | Description |
|---|---|---|
name | str = "" | The name. |
size | i64 = 0 | The size in bytes. |
is_dir | bool = false | It is a directory. |
permissions | u32 = 0 | The permissions as a Unix number. |
The example for this item is shown with the ones above: ssh-Sftp.salam
Client
struct Client| Name | Type | Description |
|---|---|---|
transport | Transport | The encrypted layer. |
cfg | Config | The configuration. |
connected | bool = false | It is connected. |
errmsg | str = "" | The error message. |
The example for this item is shown with the ones above: ssh-Exec.salam
Constants and variables
DefaultPort
const DefaultPort: i32 = 22The example for this item is shown with the ones above: ssh-Config.salam
ClientVersion
const ClientVersion: str = "SSH-2.0-Salam_1.0"The example for this item is shown with the ones above: ssh-Config.salam
HOSTKEY_MODE_INSECURE
const HOSTKEY_MODE_INSECURE: i32 = 0The example for this item is shown with the ones above: ssh-Config.salam
HOSTKEY_MODE_ACCEPT_NEW
const HOSTKEY_MODE_ACCEPT_NEW: i32 = 1The example for this item is shown with the ones above: ssh-Config.salam
HOSTKEY_MODE_STRICT
const HOSTKEY_MODE_STRICT: i32 = 2The example for this item is shown with the ones above: ssh-Config.salam
Functions
NewConfig
func NewConfig(host: str, port: int, user: str): ConfigThe example for this item is shown with the ones above: ssh-Config.salam
WithPassword
func WithPassword(cfg &: Config, password: str)The example for this item is shown with the ones above: ssh-Config.salam
WithKeyFile
func WithKeyFile(cfg &: Config, path: str): boolConnect.The example for this item is shown with the ones above: ssh-Config.salam
WithKeyPEM
func WithKeyPEM(cfg &: Config, pem: str)WithKeyFile.The example for this item is shown with the ones above: ssh-Config.salam
WithHostKeyMode
func WithHostKeyMode(cfg &: Config, mode: int)The example for this item is shown with the ones above: ssh-Config.salam
WithKnownHostsPath
func WithKnownHostsPath(cfg &: Config, path: str)The example for this item is shown with the ones above: ssh-Config.salam
NewSession
func NewSession(client &: Client): SessionThe example for this item is shown with the ones above: ssh-Exec.salam
RequestPty
func RequestPty(session &: Session, client &: Client, term: str, cols: int, rows: int): boolThe example for this item is shown with the ones above: ssh-Exec.salam
Start
func Start(session &: Session, client &: Client, cmd: str): boolThe example for this item is shown with the ones above: ssh-Exec.salam
Shell
func Shell(session &: Session, client &: Client): boolThe example for this item is shown with the ones above: ssh-Exec.salam
Wait
func Wait(session &: Session, client &: Client): intThe example for this item is shown with the ones above: ssh-Exec.salam
ReadStep
func ReadStep(session &: Session, client &: Client): boolThe example for this item is shown with the ones above: ssh-Exec.salam
Output
func Output(session: Session): strThe example for this item is shown with the ones above: ssh-Exec.salam
StderrOutput
func StderrOutput(session: Session): strThe example for this item is shown with the ones above: ssh-Exec.salam
DrainOutput
func DrainOutput(session &: Session): strThe example for this item is shown with the ones above: ssh-Exec.salam
DrainStderrOutput
func DrainStderrOutput(session &: Session): strThe example for this item is shown with the ones above: ssh-Exec.salam
ExitCode
func ExitCode(session: Session): intThe example for this item is shown with the ones above: ssh-Exec.salam
SessionClosed
func SessionClosed(session: Session): boolThe example for this item is shown with the ones above: ssh-Exec.salam
WriteInput
func WriteInput(session &: Session, client &: Client, data: str): boolThe example for this item is shown with the ones above: ssh-Exec.salam
CloseInput
func CloseInput(session &: Session, client &: Client)The example for this item is shown with the ones above: ssh-Exec.salam
CloseSession
func CloseSession(session &: Session, client &: Client)The example for this item is shown with the ones above: ssh-Exec.salam
Exec
func Exec(client &: Client, cmd: str): ExecResultThe example for this item is shown with the ones above: ssh-Exec.salam
NewBuf
func NewBuf(cap0: int): Bufimport ssh
func main:
mut b := ssh.NewBuf(64)
ssh.BufPutByte(b, 20)
ssh.BufPutUint32(b, 7 as u32)
ssh.BufPutUint64(b, 9 as u64)
ssh.BufPutBool(b, true)
ssh.BufPutStringStr(b, "ssh-ed25519,rsa-sha2-256")
ssh.BufPutString(b, "abc" as void*, 3)
ssh.BufPutBytes(b, "xy" as void*, 2)
ssh.BufPutZeros(b, 2)
ssh.BufPutMpintBytes(b, "\x80" as void*, 1)
println b.len
mut r := ssh.ReaderFromBuf(b)
println ssh.RGetByte(r), ssh.RGetUint32(r), ssh.RGetUint64(r), ssh.RGetBool(r)
names := ssh.RGetNameList(r)
println names, ssh.NameListContains(names, "rsa-sha2-256")
println ssh.RGetStringAsStr(r)
ssh.RSkip(r, 4)
println ssh.RRemaining(r)
n := ssh.RGetMpintView(r)
println n.len, ssh.RRemaining(r)
println ssh.NegotiateFirstMatch("aes256-ctr,aes128-ctr", "aes128-ctr,aes256-ctr")
println ssh.ConstantTimeEqual("abcd" as void*, "abcd" as void*, 4), ssh.ConstantTimeEqual("abcd" as void*, "abce" as void*, 4)
mut b2 := ssh.NewBuf(16)
ssh.BufPutStringBuf(b2, b)
ssh.BufPutMpintBuf(b2, b)
ssh.BufPutBuf(b2, b)
mut r2 := ssh.NewReader(b2.p, b2.len)
view := ssh.RGetStringView(r2)
println view.len == b.len
mut copied := ssh.RGetStringCopy(ssh.ReaderFromBuf(b2))
mut number := ssh.RGetMpintCopy(r2)
println copied.len, number.len, ssh.RRemaining(r2)
ssh.WipeBuf(b)
ssh.FreeBuf(b)
ssh.FreeBuf(b2)
ssh.FreeBuf(copied)
ssh.FreeBuf(number)
endFreeBuf
func FreeBuf(b &: Buf)The example for this item is shown with the ones above: ssh-Wire.salam
WipeBuf
func WipeBuf(b &: Buf)The example for this item is shown with the ones above: ssh-Wire.salam
BufPutByte
func BufPutByte(b &: Buf, v: int)The example for this item is shown with the ones above: ssh-Wire.salam
BufPutBytes
func BufPutBytes(b &: Buf, p: void*, n: int)The example for this item is shown with the ones above: ssh-Wire.salam
BufPutBuf
func BufPutBuf(b &: Buf, src: Buf)The example for this item is shown with the ones above: ssh-Wire.salam
BufPutZeros
func BufPutZeros(b &: Buf, n: int)The example for this item is shown with the ones above: ssh-Wire.salam
BufPutUint32
func BufPutUint32(b &: Buf, v: u32)The example for this item is shown with the ones above: ssh-Wire.salam
BufPutUint64
func BufPutUint64(b &: Buf, v: u64)The example for this item is shown with the ones above: ssh-Wire.salam
BufPutBool
func BufPutBool(b &: Buf, v: bool)The example for this item is shown with the ones above: ssh-Wire.salam
BufPutString
func BufPutString(b &: Buf, p: void*, n: int)The example for this item is shown with the ones above: ssh-Wire.salam
BufPutStringBuf
func BufPutStringBuf(b &: Buf, src: Buf)The example for this item is shown with the ones above: ssh-Wire.salam
BufPutStringStr
func BufPutStringStr(b &: Buf, s: str)The example for this item is shown with the ones above: ssh-Wire.salam
BufPutMpintBytes
func BufPutMpintBytes(b &: Buf, p: void*, n: int)The example for this item is shown with the ones above: ssh-Wire.salam
BufPutMpintBuf
func BufPutMpintBuf(b &: Buf, src: Buf)The example for this item is shown with the ones above: ssh-Wire.salam
NewReader
func NewReader(p: void*, n: int): ReaderThe example for this item is shown with the ones above: ssh-Wire.salam
ReaderFromBuf
func ReaderFromBuf(b: Buf): ReaderThe example for this item is shown with the ones above: ssh-Wire.salam
RRemaining
func RRemaining(r: Reader): intThe example for this item is shown with the ones above: ssh-Wire.salam
RGetByte
func RGetByte(r &: Reader): intThe example for this item is shown with the ones above: ssh-Wire.salam
RGetBool
func RGetBool(r &: Reader): boolThe example for this item is shown with the ones above: ssh-Wire.salam
RSkip
func RSkip(r &: Reader, n: int)The example for this item is shown with the ones above: ssh-Wire.salam
RGetUint32
func RGetUint32(r &: Reader): u32The example for this item is shown with the ones above: ssh-Wire.salam
RGetUint64
func RGetUint64(r &: Reader): u64The example for this item is shown with the ones above: ssh-Wire.salam
RGetStringView
func RGetStringView(r &: Reader): ReaderThe example for this item is shown with the ones above: ssh-Wire.salam
RGetStringCopy
func RGetStringCopy(r &: Reader): BufThe example for this item is shown with the ones above: ssh-Wire.salam
RGetStringAsStr
func RGetStringAsStr(r &: Reader): strThe example for this item is shown with the ones above: ssh-Wire.salam
RGetMpintView
func RGetMpintView(r &: Reader): ReaderThe example for this item is shown with the ones above: ssh-Wire.salam
RGetMpintCopy
func RGetMpintCopy(r &: Reader): BufThe example for this item is shown with the ones above: ssh-Wire.salam
RGetNameList
func RGetNameList(r &: Reader): strThe example for this item is shown with the ones above: ssh-Wire.salam
NameListContains
func NameListContains(list: str, name: str): boolThe example for this item is shown with the ones above: ssh-Wire.salam
NegotiateFirstMatch
func NegotiateFirstMatch(mine: str, theirs: str): strThe example for this item is shown with the ones above: ssh-Wire.salam
ConstantTimeEqual
func ConstantTimeEqual(a: void*, b: void*, n: int): boolThe example for this item is shown with the ones above: ssh-Wire.salam
SftpOpen
func SftpOpen(client &: Client): SftpThe example for this item is shown with the ones above: ssh-Sftp.salam
SftpClose
func SftpClose(client &: Client, sftp &: Sftp)The example for this item is shown with the ones above: ssh-Sftp.salam
Upload
func Upload(client &: Client, sftp &: Sftp, local_path: str, remote_path: str): boolThe example for this item is shown with the ones above: ssh-Sftp.salam
Download
func Download(client &: Client, sftp &: Sftp, remote_path: str, local_path: str): boolThe example for this item is shown with the ones above: ssh-Sftp.salam
Mkdir
func Mkdir(client &: Client, sftp &: Sftp, path: str): boolThe example for this item is shown with the ones above: ssh-Sftp.salam
Remove
func Remove(client &: Client, sftp &: Sftp, path: str): boolThe example for this item is shown with the ones above: ssh-Sftp.salam
Rmdir
func Rmdir(client &: Client, sftp &: Sftp, path: str): boolThe example for this item is shown with the ones above: ssh-Sftp.salam
Rename
func Rename(client &: Client, sftp &: Sftp, old_path: str, new_path: str): boolThe example for this item is shown with the ones above: ssh-Sftp.salam
Stat
func Stat(client &: Client, sftp &: Sftp, path: str): SftpFileInfoThe example for this item is shown with the ones above: ssh-Sftp.salam
Exists
func Exists(client &: Client, sftp &: Sftp, path: str): boolThe example for this item is shown with the ones above: ssh-Sftp.salam
ListDir
func ListDir(client &: Client, sftp &: Sftp, path: str): Vector<SftpFileInfo>. and ...The example for this item is shown with the ones above: ssh-Sftp.salam
MkdirAll
func MkdirAll(client &: Client, sftp &: Sftp, path: str): boolThe example for this item is shown with the ones above: ssh-Sftp.salam
RemoveAll
func RemoveAll(client &: Client, sftp &: Sftp, path: str): boolThe example for this item is shown with the ones above: ssh-Sftp.salam
DownloadDir
func DownloadDir(client &: Client, sftp &: Sftp, remote_path: str, local_path: str): boolThe example for this item is shown with the ones above: ssh-Sftp.salam
UploadDir
func UploadDir(client &: Client, sftp &: Sftp, local_path: str, remote_path: str): boolThe example for this item is shown with the ones above: ssh-Sftp.salam
Lstat
func Lstat(client &: Client, sftp &: Sftp, path: str): SftpFileInfoThe example for this item is shown with the ones above: ssh-Sftp.salam
IsLink
func IsLink(client &: Client, sftp &: Sftp, path: str): boolThe example for this item is shown with the ones above: ssh-Sftp.salam
SelfTest
func SelfTest(): intThe example for this item is shown with the ones above: ssh-Exec.salam
Dial
func Dial(cfg: Config): ClientThe example for this item is shown with the ones above: ssh-Exec.salam
Connect
func Connect(cfg: Config): ClientThe example for this item is shown with the ones above: ssh-Exec.salam
Ok
func Ok(client: Client): boolThe example for this item is shown with the ones above: ssh-Exec.salam
Error
func Error(client: Client): strThe example for this item is shown with the ones above: ssh-Exec.salam
HostKeyFingerprint
func HostKeyFingerprint(client: Client): strssh shows.The example for this item is shown with the ones above: ssh-Exec.salam
Close
func Close(client &: Client)The example for this item is shown with the ones above: ssh-Exec.salam
Reconnect
func Reconnect(client &: Client): boolThe example for this item is shown with the ones above: ssh-Exec.salam
RunCommand
func RunCommand(client &: Client, cmd: str): ExecResultExec.The example for this item is shown with the ones above: ssh-Exec.salam