Skip to content

Commit 8964874

Browse files
das7padtechknowlogick
authored andcommitted
[ssh] fix the config specification in the authorized_keys template (#8031)
The gitea flags must appear in front of the gitea command. Otherwise they are ignored. Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
1 parent 4959bf1 commit 8964874

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

models/ssh_key.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import (
3636

3737
const (
3838
tplCommentPrefix = `# gitea public key`
39-
tplPublicKey = tplCommentPrefix + "\n" + `command="%s serv key-%d --config='%s'",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s` + "\n"
39+
tplPublicKey = tplCommentPrefix + "\n" + `command="%s --config='%s' serv key-%d",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s` + "\n"
4040
)
4141

4242
var sshOpLocker sync.Mutex
@@ -81,7 +81,7 @@ func (key *PublicKey) OmitEmail() string {
8181

8282
// AuthorizedString returns formatted public key string for authorized_keys file.
8383
func (key *PublicKey) AuthorizedString() string {
84-
return fmt.Sprintf(tplPublicKey, setting.AppPath, key.ID, setting.CustomConf, key.Content)
84+
return fmt.Sprintf(tplPublicKey, setting.AppPath, setting.CustomConf, key.ID, key.Content)
8585
}
8686

8787
func extractTypeFromBase64Key(key string) (string, error) {

0 commit comments

Comments
 (0)