Linux study 1, useradd

Source: Internet
Author: User

  • Install VMware
  • Install Linux
  • When installing Linux, a user, dragon, and password are created... This user is not a root user and has no root permission.
  • You can switch dragon to the user root. At this time, you have the root permission. The password is the same as the password of the user created for installation.
  • Some commands are not allowed for common users.
  • Common and root users

    Http://blog.sina.com.cn/s/blog_67d873600100kst1.html

    Http://www.cnblogs.com/xd502djj/archive/2011/11/23/2260094.html

  • Enter the root user

  • At this time, no command useradd is found. You can use the locate command to view all the paths related to useradd.

    Go to/usr/sbin/and you will see the useradd program. Why is it not found?

  • You can use the full path to find the command, similar to windows

  • The problem is that the command program exists in a path and runs a command in GNU bash. How does it find these programs? The secret is that there is an OS environment variable, as shown in $ PATH. $ PATH does not contain the/usr/sbin PATH in the environment variable, therefore, GNU bash cannot find program commands not included in this path.

  • Bash, or shell, just same as cmd in Windows

  • To use commands in other paths, Method 1: export the command PATH to the current OS environment variable $ PATH, as shown in. The PATH is already in the current environment variable, the useradd command is available.

  • The above method is to temporarily change the environment variable, that is, when GNU bash runs, it reads the environment variable from the file, but during the running process, you can use the export command to dynamically change this variable, the environment variable is like a variable. Export is a command of the GNU bash program, not the command of other paths.

    For example:

  • If you exit bash, the changes made to the environment variables will be lost. Start bash again. bash then reads the parameters from the file and resets the environment variables. To modify $ PATH once and for all, follow these steps:

  • View OS environment variables

 

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.