Closed Walter-Gu closed 2 years ago
@TimeVfx according to your shell you're still Jane:
2022/09/29 11:38:31 debug: User
Jane
2022/09/29 11:38:31 User duration: 2.927µs, args:
This comes from the USER
environment variable which this command should update in that case. If not, the bug is elsewhere on your system.
Thanks! Cannot use "su root "when Jane logs in, should be used "su - root" "-" make the shell a login shell
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.
Code of Conduct
What happened?
ubuntu login user "Jane"
"template": "{{ .UserName }}@{{ .HostName }} ",
.UserName display Jane
when "sudo su root " .UserName display Jane
Username is always Jane, cannot display root
Theme
{ "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", "blocks": [ { "alignment": "left", "segments": [ { "background": "#222222", "foreground": "#666666", "leading_diamond": "\ue0b6", "style": "diamond", "template": "{{ .UserName }}@{{ .HostName }} ", "type": "session" }, { "background": "#0087D8", "foreground": "#003544", "powerline_symbol": "\ue0b0", "properties": { "folder_separator_icon": "/", "style": "full" }, "style": "powerline", "template": " {{ .Path }} ", "type": "path" }, { "background": "#d2ff5e", "background_templates": [ "{{ if or (.Working.Changed) (.Staging.Changed) }}#ff9248{{ end }}", "{{ if and (gt .Ahead 0) (gt .Behind 0) }}#f26d50{{ end }}", "{{ if gt .Ahead 0 }}#89d1dc{{ end }}", "{{ if gt .Behind 0 }}#f17c37{{ end }}" ], "foreground": "#193549", "powerline_symbol": "\ue0b0", "properties": { "branch_icon": "", "fetch_stash_count": true, "fetch_status": true, "fetch_upstream_icon": true }, "style": "powerline", "template": " {{ .UpstreamIcon }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} {{ .StashCount }}{{ end }} ", "type": "git" }, { "background": "#003543", "foreground": "#fff", "powerline_symbol": "\ue0b0", "style": "powerline", "template": "<#fff> </>{{ .CurrentDate | date .Format }} ", "type": "time" }, { "background": "#83769c", "foreground": "#ffffff", "properties": { "always_enabled": true }, "style": "diamond", "template": " {{ .FormattedMs }}", "trailing_diamond": "\ue0b4", "type": "executiontime" } ], "type": "prompt" }, { "alignment": "left", "newline": true, "segments": [ { "foreground": "#f5b403", "style": "plain", "template": " >>> ", "type": "root" }, { "foreground": "#f1184c", "style": "plain", "template": "", "type": "text" } ], "type": "prompt" } ], "console_title_template": "{{.UserName}}@{{.HostName}} in {{ .PWD }}", "final_space": true, "version": 2 }
What OS are you seeing the problem on?
Linux
Which shell are you using?
bash
Log output