The difference between Su and Su-commands under Linux

Source: Internet
Author: User

A problem occurred while starting the server NTPD service

You cannot use the service command after switching to the root user using SU root;

After using Su-, you can use the service command.

Reason:

The difference between the SU command and the Su-command is:

Su simply switches the root identity, but the shell environment is still a normal user's shell, and Su-even the user and shell environment switch to root identity. The PATH environment variable error is not reported by the command not found only if the shell environment is switched.

After the SU switch to the root user, PWD, found that the working directory is still the normal user's working directory, and after the Su-command switch, the working directory becomes the working directory of root.

Use the Echo $PATH command to look at Su and Su-after the environment variable has changed.

And so on, to switch from the current user to another user, you should use the Su-command.

Reference: (summary) The essential difference between Su and Su-commands under Linux

The difference between Su and Su-commands under Linux

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.