mirror of
https://github.com/nwtgck/handy-sshd.git
synced 2025-06-14 12:04:50 +00:00
require one user at least
This commit is contained in:
parent
0b3b8d0f96
commit
54b502d3ae
2 changed files with 5 additions and 3 deletions
|
@ -101,7 +101,11 @@ var RootCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
sshUsers = append(sshUsers, sshUser{name: splits[0], password: splits[1]})
|
sshUsers = append(sshUsers, sshUser{name: splits[0], password: splits[1]})
|
||||||
}
|
}
|
||||||
|
if len(sshUsers) == 0 {
|
||||||
|
return fmt.Errorf(`No user specified
|
||||||
|
e.g. --user "john:mypassword"
|
||||||
|
e.g. --user "john:"`)
|
||||||
|
}
|
||||||
// (base: https://gist.github.com/jpillora/b480fde82bff51a06238)
|
// (base: https://gist.github.com/jpillora/b480fde82bff51a06238)
|
||||||
sshConfig := &ssh.ServerConfig{
|
sshConfig := &ssh.ServerConfig{
|
||||||
//Define a function to run when a client attempts a password login
|
//Define a function to run when a client attempts a password login
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"github.com/nwtgck/handy-sshd/cmd"
|
"github.com/nwtgck/handy-sshd/cmd"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if err := cmd.RootCmd.Execute(); err != nil {
|
if err := cmd.RootCmd.Execute(); err != nil {
|
||||||
_, _ = fmt.Fprintf(os.Stderr, err.Error())
|
|
||||||
os.Exit(-1)
|
os.Exit(-1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue