If it's empty or not present the default user of `ssh` is used. This is
either the current user or the user configured in ~/.ssh/config.
type Host struct {
Name string `yaml:"name"`
+
+ SshUser string `yaml:"ssh_user"`
}
func LoadHosts() (*Hosts, error) {
}()
// Connect to remote host
- err := conn.DialSSH(s.host.Name)
+ err := conn.DialSSH(s.host.SshUser, s.host.Name)
if err != nil {
return err
}
"ruderich.org/simon/safcm/remote"
)
-func (c *Conn) DialSSH(remote string) error {
+func (c *Conn) DialSSH(user, host string) error {
if c.events == nil {
return fmt.Errorf("cannot reuse Conn")
}
+ remote := host
+ if user != "" {
+ remote = user + "@" + host
+ }
c.debugf("DialSSH: connecting to %q", remote)
opts := "-eu"