@@ -124,6 +124,14 @@ func parseSshdConfig(path, user string, groups []string) {
124124 sshdConfigMap = make (map [string ]string )
125125 sshdSubsystemMap = make (map [string ]string )
126126
127+ // While OpenSSH defaults AcceptEnv to empty, most Linux distributions
128+ // (e.g., Ubuntu, Debian, CentOS) include "LANG" and "LC_*" by default
129+ // to preserve locale settings across SSH sessions.
130+ // We follow this convention as our internal default. However, we also
131+ // support explicitly setting AcceptEnv to an empty value in the
132+ // configuration to override this behavior and clear all accepted variables.
133+ sshdConfigMap ["AcceptEnv" ] = "LANG LC_*"
134+
127135 file , err := os .Open (path )
128136 if err != nil {
129137 return
@@ -142,11 +150,8 @@ func parseSshdConfig(path, user string, groups []string) {
142150 }
143151
144152 key , value := splitKeyValue (line )
145- if value == "" {
146- continue
147- }
148153
149- if key == "match" {
154+ if key == "match" && value != "" {
150155 inMatch = true
151156 userMatch = evalMatchLine (value , user , groups )
152157 continue
@@ -156,9 +161,9 @@ func parseSshdConfig(path, user string, groups []string) {
156161 continue
157162 }
158163
159- if key == "subsystem" {
164+ if key == "subsystem" && value != "" {
160165 name , path := splitKeyValue (value )
161- if name != "" && path != "" {
166+ if name != "" {
162167 sshdSubsystemMap [name ] = path
163168 }
164169 continue
0 commit comments