Why when I try to switch user, my console change name from this (%username%@laba2docker) to this ($). I don't have autocomplete in this mode. How can i fix it?
1 Answers
The "fancy" prompt and completion are features of the shell - it looks like your regular user is using bash
whereas you are getting a simpler shell (most likely dash
, as the default /bin/sh
) when switched to the admin
user.
By default, the utli-linux implementation of the su
command selects the shell to use according to the following rules (from man su
):
• the shell specified with --shell
• the shell specified in the environment variable SHELL, if the
--preserve-environment option is used
• the shell listed in the passwd entry of the target user
• /bin/sh
Since you didn't specify a shell with --shell
or use the --preserve-environment
option, it is likely that the admin
user's login shell is either set to /bin/sh
or not set at all - you can use the chsh
utility to set or change it:
chsh -s /bin/bash
from theadmin
accountsudo chsh -s /bin/bash admin
from another user account with suitablesudo
privileges
See also Arrow keys, Home, End, tab-complete keys not working in shell

- 136,215
- 21
- 243
- 336
admin
's login shell something other thanbash
(perhaps/bin/sh
?) – steeldriver Oct 01 '22 at 13:08echo $SHELL
from theadmin
account and/orgetent passwd admin
from any account (login shell is in the last field) – steeldriver Oct 01 '22 at 13:38