weaveworks / footloose

Container Machines - Containers that look like Virtual Machines

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suggest to add "user" into Machine spec

brightzheng100 opened this issue · comments

I found that the SSH pub key is hardcoded to be in /root/.ssh which indicates that the SSH user is actually root.

In this case, if I run footloose ssh without specifying the user, like footloose ssh root@host xxx, the user will be retrieved by current OS user, which doesn't make sense in most of the cases:
https://github.com/weaveworks/footloose/blob/master/ssh.go#L37-L51

So I'd suggest to add a new element in Machine spec, with "root" as the default value, like this:

// Machine is a single machine.
type Machine struct {
	spec *config.Machine

	// container name.
	name string
	// container hostname.
	hostname string
	// container ip.
	ip string
	// container user, defaults to "root".
	user string

	runtimeNetworks []*RuntimeNetwork
	// Fields that are cached from the docker daemon.

	ports map[int]int
	// maps containerPort -> hostPort.
}

What do you think?

Hello, I am starting to work on this issue.