Linux problem: Switch users and then become-bash-4.1$

Source: Internet
Author: User

New User Git

Add user    #sudo useradd-m-s/bin/bash-g Group LoginName    -M to create the home directory (without this to manually add the directory, otherwise no directory,logging in with H ome=/)    -s/bin/bash use Bash (default to/bin/sh Use default does not appear in front of the $ [email protected])-    g Group and then use passwd to change the user password

Su git then becomes:

bash-4.1$

Internet search solves the problem as follows.

If the user environment profile is missing, then why do you need such a file, which is related to the Linux mechanism, because every time you create a new user through Useradd in Linux, all the configuration files are copied from/etc/skel to the new user's home directory. The general default is the new user home directory under Home, and about/etc/skel This directory is mainly used by Useradd.

With the above resolution, it is not difficult to find out how to resolve the command after the user switch to the bash format, you need to copy the/etc/skel user environment profile to the specified default directory, as follows:

Workaround: cp-a/etc/skel/. /home/git

Linux problem: Switch users and then become-bash-4.1$

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.