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?
-
Is `admin`'s login shell something other than `bash` (perhaps `/bin/sh`?) – steeldriver Oct 01 '22 at 13:08
-
idk, how can i check it? – comm1ted Oct 01 '22 at 13:11
-
1Use `echo $SHELL` from the `admin` account and/or `getent passwd admin` from any account (login shell is in the last field) – steeldriver Oct 01 '22 at 13:38
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/bashfrom theadminaccountsudo chsh -s /bin/bash adminfrom another user account with suitablesudoprivileges
See also Arrow keys, Home, End, tab-complete keys not working in shell
- 131,985
- 21
- 239
- 326
