digitalocean / doctl

The official command line interface for the DigitalOcean API.
https://docs.digitalocean.com/reference/doctl/
Apache License 2.0
3.26k stars 397 forks source link

allow ``ssh-user`` and ``ssh-port`` to be specified in config file #167

Closed mman closed 7 years ago

mman commented 7 years ago

We are using non standard ssh port and non-root user to admin all machines, we need to specify them via command line every time we want to doctl compute ssh.

xmudrii commented 7 years ago

Both ssh-user and ssh-port can be specified via config file. For OS X and Linux, location of file is ~/.config/doctl/doctl.yaml. In that file you have following lines:

...
compute.ssh.ssh-agent-forwarding: false
compute.ssh.ssh-key-path: /home/marko/.ssh/id_rsa
compute.ssh.ssh-port: 22
compute.ssh.ssh-private-ip: false
compute.ssh.ssh-user: root
...
mman commented 7 years ago

That is cool, I knew about the config file but have not seen anywhere mentioned the actual syntax. Could this be please documented in doctl README with the example above?

thanks a lot, Martin

xmudrii commented 7 years ago

Maybe a few Wiki pages could be created to serve like tutorial for usage and things like above. I will see with collaborators about it, I could make Wiki pages in free time so they can publish it if it's interested.

There is DO Tutorial for basic usage, but I'm not sure is it updated well and it doesn't cover everything.

I also have some plans for doctl that will be proposed when I find free time.

@nanzhong what you think about wiki pages? :D I think it this issue could be closed :)

xmudrii commented 7 years ago

@mauricio i think this one could be closed as well README states config file, and there could be added few things about config in tutorial if we get on it

vendion commented 7 years ago

Are these settings global or can it be set on a per droplet bases? One use case for a per droplet bases would a user/team has a mix of Linux and FreeBSD droplets, while the default root user may be okay for Linux images ssh as root is disabled by default so unless a common account is created across droplets a global setting is less useful.

xmudrii commented 7 years ago

@vendion The defaults are global. Maybe it can be coded to check if it's FreeBSD image to use BSD default user instead of root. I could try to play around it.