[systemd-devel] machinectl shell .bashrc
Mantas Mikulėnas
grawity at gmail.com
Thu Aug 17 04:27:57 UTC 2023
By default `machinectl shell` runs the user's shell with the "login" flag,
exactly as during console or SSH logins. For Bash, that means it will look
for ~/.bash_profile or ~/.profile *instead of* ~/.bashrc.
Usually people have a ~/.bash_profile that sets up "once per session"
things if any, then manually sources ~/.bashrc (with the '.' or 'source'
command) as Bash never does do so automatically.
The same applies to global configs; Bash in login mode will read
/etc/profile, but not /etc/bash.bashrc unless the latter is explicitly
sourced (e.g. Arch's /etc/profile has an "if [ "$BASH" ]; then .
/etc/bash.bashrc; fi").
On Thu, Aug 17, 2023 at 3:09 AM LuKaRo <lists at lrose.de> wrote:
> Hi,
>
> somehow, when using machinectl shell to access my nspawn containers, my
> .bashrc is ignored, although bash is correctly used as my shell. However,
> when specifying /bin/bash explicitly, the .bashrc gets sourced correctly.
> Any ideas?
>
> *lukas at home*:*~*$ sudo machinectl shell x11
> Connected to machine x11. Press ^] three times within 1s to exit session.
> [root at x11 ~]# echo $HISTFILESIZE; echo $0;
> 500
> /bin/bash
> [root at x11 ~]#
> logout
> Connection to machine x11 terminated.*lukas at home*:*~*$ sudo machinectl shell x11 /bin/bash
> Connected to machine x11. Press ^] three times within 1s to exit session.*root at x11*:*~*# echo $HISTFILESIZE; echo $0;
>
> /bin/bash*root at x11*:*~*#
> exit
> Connection to machine x11 terminated.*lukas at home*:*~*$
>
> Thanks,
> lukaro
>
--
Mantas Mikulėnas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20230817/128d05fc/attachment.htm>
More information about the systemd-devel
mailing list