File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -166,10 +166,20 @@ func NewCmdUp() *cobra.Command {
166166 }
167167 }
168168
169- for _ , authorizedKeysPath := range []string {
170- filepath .Join (os .Getenv ("HOME" ), ".ssh" , "authorized_keys" ),
169+ authorizedKeysPaths := []string {
171170 filepath .Join (k .String ("dir" ), ".smallweb" , "authorized_keys" ),
172- } {
171+ filepath .Join (k .String ("dir" ), ".smallweb" , "authorized_keys" ),
172+ }
173+
174+ if user := ctx .User (); user != "_" {
175+ authorizedKeysPaths = append (authorizedKeysPaths , filepath .Join (k .String ("dir" ), user , "authorized_keys" ))
176+ }
177+
178+ for _ , authorizedKeysPath := range authorizedKeysPaths {
179+ if _ , err := os .Stat (authorizedKeysPath ); err != nil {
180+ continue
181+ }
182+
173183 ok , err := validatePublicKey (authorizedKeysPath , key )
174184 if err != nil {
175185 if errors .Is (err , os .ErrNotExist ) {
You can’t perform that action at this time.
0 commit comments