Permission-execute shell-su as other users and group IDs

Source: Internet
Author: User
If the password is correct, a new shell prompt will appear. Once we enter the new shell environment, we can execute commands as super users.

Introduction

The su command starts the shell as another user.

========================================================== ===

The command is generally in the following format:

Su [-[l] [user]

If the "-l" option is included, the shell session interface is used to specify the user's logon shell (login shell) interface.

This means that the running environment of the specified user will be loaded and its working directory will be changed to the main directory of the specified user.

This is often the result we want.

If no user is specified, it is assumed that the user is a super user by default.

Note that-l can be abbreviated as-, and this form is often used.

========================================================== ===

For example

[Allyes_op @ allyes ~] $ Su-

Password:

========================================================== ===

Description

After entering the su command, the system prompts you to enter the password.

If the password is correct, a new shell prompt will appear. Once we enter the new shell environment, we can execute commands as super users.

========================================================== ===

We can also use the su command to execute a single command.

Format: su-c 'command '.

In this format, a single command line is passed to a new shell environment for execution. The command must be enclosed in single quotes and cannot be omitted.

Related Article

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.