Skip to content

Commit d78aa18

Browse files
das7padlunny
authored andcommitted
[ssh] fix the config specification in the authorized_keys template (#8031) (#8193)
The gitea flags must appear in front of the gitea command. Otherwise they are ignored. Signed-off-by: Jakob Ackermann <[email protected]> (cherry picked from commit 8964874)
1 parent 6883c00 commit d78aa18

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
@@ -32,7 +32,7 @@ import (
3232

3333
const (
3434
tplCommentPrefix = `# gitea public key`
35-
tplPublicKey = tplCommentPrefix + "\n" + `command="%s serv key-%d --config='%s'",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s` + "\n"
35+
tplPublicKey = tplCommentPrefix + "\n" + `command="%s --config='%s' serv key-%d",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s` + "\n"
3636
)
3737

3838
var sshOpLocker sync.Mutex
@@ -77,7 +77,7 @@ func (key *PublicKey) OmitEmail() string {
7777

7878
// AuthorizedString returns formatted public key string for authorized_keys file.
7979
func (key *PublicKey) AuthorizedString() string {
80-
return fmt.Sprintf(tplPublicKey, setting.AppPath, key.ID, setting.CustomConf, key.Content)
80+
return fmt.Sprintf(tplPublicKey, setting.AppPath, setting.CustomConf, key.ID, key.Content)
8181
}
8282

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

0 commit comments

Comments
 (0)