1

I'm using Kali Linux for one of my classes, and part of our first assignment is to create a custom user account using our names instead of the default kali login, however when I do this it messes with the terminal

This is the default kali terminal: enter image description here

And this is the user terminal:

enter image description here

On top of the colors, the shell is way harder to use. There are no suggestions, no autocomplete, and it doesn't allow scrolling or anything other than typing. I'm not sure how to get user terminals to look like the default kali one. I tried copying the .bashrc from /home/kali to /home/jeff, but that didn't seem to change anything.

Text from copied .bashrc:

 ~/.bashrc: executed by bash(1) for non-login shells. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # for examples # If not running interactively, don't do anything case $- in *i*) ;; *) return;; esac # don't put duplicate lines or lines starting with space in the history. # See bash(1) for more options HISTCONTROL=ignoreboth # append to the history file, don't overwrite it shopt -s histappend # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) HISTSIZE=1000 HISTFILESIZE=2000 # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize # If set, the pattern "**" used in a pathname expansion context will # match all files and zero or more directories and subdirectories. #shopt -s globstar # make less more friendly for non-text input files, see lesspipe(1) #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" # set variable identifying the chroot you work in (used in the prompt below) if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi # set a fancy prompt (non-color, unless we know we "want" color) case "$TERM" in xterm-color|*-256color) color_prompt=yes;; esac # uncomment for a colored prompt, if the terminal has the capability; turned # off by default to not distract the user: the focus in a terminal window # should be on the output of commands, not on the prompt force_color_prompt=yes if [ -n "$force_color_prompt" ]; then if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then # We have color support; assume it's compliant with Ecma-48 # (ISO/IEC-6429). (Lack of such support is extremely rare, and such # a case would tend to support setf rather than setaf.) color_prompt=yes else color_prompt= fi fi if [ "$color_prompt" = yes ]; then prompt_color='\[\033[;32m\]' info_color='\[\033[1;34m\]' prompt_symbol=γ‰Ώ if [ "$EUID" -eq 0 ]; then # Change prompt colors for root user prompt_color='\[\033[;94m\]' info_color='\[\033[1;31m\]' prompt_symbol=πŸ’€ fi PS1=$prompt_color'β”Œβ”€β”€${debian_chroot:+($debian_chroot)──}('$info_color'\u${prompt_symbol}\h'$prompt_color')-[\[\033[0;1m\]\w'> # BackTrack red prompt #PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi unset color_prompt force_color_prompt # If this is an xterm set the title to user@host:dir case "$TERM" in xterm*|rxvt*) PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" ;; *) ;; esac # enable color support of ls, less and man, and also add handy aliases if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" alias ls='ls --color=auto' #alias dir='dir --color=auto' #alias vdir='vdir --color=auto' alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' alias diff='diff --color=auto' alias ip='ip --color=auto' export LESS_TERMCAP_mb=$'\E[1;31m' # begin blink export LESS_TERMCAP_md=$'\E[1;36m' # begin bold export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink export LESS_TERMCAP_so=$'\E[01;33m' # begin reverse video export LESS_TERMCAP_se=$'\E[0m' # reset reverse video export LESS_TERMCAP_us=$'\E[1;32m' # begin underline export LESS_TERMCAP_ue=$'\E[0m' # reset underline fi # colored GCC warnings and errors #export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' # some more ls aliases alias ll='ls -l' alias la='ls -A' alias l='ls -CF' # Alias definitions. # You may want to put all your additions into a separate file like # ~/.bash_aliases, instead of adding them here directly. # See /usr/share/doc/bash-doc/examples in the bash-doc package. if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi # enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). if ! shopt -oq posix; then if [ -f /usr/share/bash-completion/bash_completion ]; then . /usr/share/bash-completion/bash_completion elif [ -f /etc/bash_completion ]; then . /etc/bash_completion fi fi 

There is a .profile, this is the contents:

# ~/.profile: executed by the command interpreter for login shells. # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login # exists. # see /usr/share/doc/bash/examples/startup-files for examples. # the files are located in the bash-doc package. # the default umask is set in /etc/profile; for setting the umask # for ssh logins, install and configure the libpam-umask package. #umask 022 # if running bash if [ -n "$BASH_VERSION" ]; then # include .bashrc if it exists if [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" fi fi # set PATH so it includes user's private bin if it exists if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi # set PATH so it includes user's private bin if it exists if [ -d "$HOME/.local/bin" ] ; then PATH="$HOME/.local/bin:$PATH" fi 
6
  • You're on the right track by trying to copy kali's bashrc to jeff. What we're missing to be able to answer the question properly is what commands you actually ran to do this, what are the contents of the bashrc, and is there maybe also a .bash_profile or .profile which is providing additional configuration for kali user. (Check ls -a in kali's home directory.) I mention commands for being able to reproduce it specifically because one of my suspicions is that you copied the file to jeff without changing ownership or mode. Commented Feb 3, 2021 at 19:14
  • 1
    You're right, I didn't do anything to change ownership or modes. I used cp .bash_profile /home/jeff from the /home/kali directory. I will update the question with the contents of bashrc Commented Feb 3, 2021 at 19:59
  • I also suggest changing the question title to something like "Prompt string not set properly in Bash for new user", since the principles we're discussing are true regardless of which distro or terminal you're using. I believe you can tag the question with something like kali-linux if you want to draw people focused on the specific distro. Commented Feb 3, 2021 at 20:04
  • If I do exec bash I can load the colors from the .bashrc profile, but there still is no autocomplete or suggestions Commented Feb 3, 2021 at 20:12
  • I just had another thought. Could you also please give the output from grep jeff /etc/passwd Commented Feb 3, 2021 at 20:18

2 Answers 2

0

Based on the information in the question, a few different things are leading to the outcome you're experiencing.

A key principle to keep in mind is that in Linux there are multiple different shells available, such as dash, csh, bash and zsh. A shell is simply any program which offers you a prompt, accepts commands, and returns output. The "standard" shells all have similarities, but they also have differences in functionality and method of configuration.

Furthermore, each distro chooses a default shell for new users, which is often (but not always) Bash. For distros preferring performance and reduction in non-standard extensions, sh is often chosen (often by creating a symbolic link to another shell, which then runs in sh-compatibility mode).

We can see in the /etc/passwd output in one of the comments that Kali has defaulted to giving your jeff user the sh shell. While very performant, this choice lacks features such as configurable prompt and command completion.

So, step one for fixing it will be to run a command like so:

sudo chsh -s /bin/bash jeff 

As already discussed in the comments, it seemed like the rest of the issue came down to permissions. Each user's shell configuration files such as ~/.bashrc need to be readable by the user.

Note that the shell defaults can be changed system-wide for new users by editing (or adding) /etc/defaults/useradd and an /etc/skel/ directory.

My /etc/defaults/useradd (for Void Linux) contains:

# useradd defaults file GROUP=100 HOME=/home INACTIVE=-1 EXPIRE= SHELL=/bin/bash SKEL=/etc/skel CREATE_MAIL_SPOOL=no 

Files in /etc/skel are copied to a new user's home directory as a side-effect of running the useradd command.

0

Had the same problem, despite having configured everything properly. Not sure what was going on, but:

sudo shutdown /r

With a simple restart, I made it work.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.