simulate local user login from other session in linux


In linux sudo or su permit to chage user , but those sessions are not registered as local login in systemd, nor every environment variable is inherited

to fully replicate a local login from another shell:

machinectl shell "user"@.host

This command fully emulate local login from another shell