When logging in to a new user in a Linux system, the shell starts with $, and the user name and path are not displayed.

Problem description: In the Linux system, after using the useradd command to create a new user, when logging in to the user, the shell starts with $, and the user name and path are not displayed, as follows:

$
$
$

 Solution: After viewing the /etc/passwd file, it is found that the newly created user does not specify a shell. We just need to specify it as /bin/bash.

  1. Switch to root user
  2. Use the usermod command to modify the shell type
$su
$
root@VM-202-164-ubuntu:/app# usermod -s /bin/bash du
root@VM-202-164-ubuntu:/app#

 Successfully solved!

 

If it is not resolved, please try the following methods (excerpted from other people's methods, failed to try):

  1. Add the following code to ~/.bash_profile, if there is no such file, you can create it yourself:
    you ~ / .bash_profile
    #join in
    #export PS1='[u@h W]$'
    #keep
     
  2. Make the variable take effect:
    source ~/.bash_profile
     
  3. re-register

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326182912&siteId=291194637