Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the su command in Linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to use the su command in Linux". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to use the su command in Linux.

The su command is used to switch the current user identity to another user identity. When changing, you must enter the user account number and password to be changed.

Su common command parameter usage: su [options]... [-] [user [parameter]. ] Change the effective user id and group id to that of USER. -,-l,-- login make the shell a login shell-c,-- command=COMMAND pass a single COMMAND to the shell with-c-- session-command=COMMAND pass a single COMMAND to the shell with-c and do not create a new session- f,-- fast pass-f to the shell (for csh or tcsh)-m -- preserve-environment do not reset environment variables-p same as-m-s,-- shell=SHELL run SHELL if / etc/shells allows it-- help displays this help and exits-- version displays version information and exits the separate "-" option implies-l. If you do not specify a user, it is assumed to be root.

Show details

Display of commonly used commands

Switch omd user

Su``-omd ``# root switch other users do not need to enter a password. Ordinary users need to know the login password of that user to switch passwords directly

Execute the command directly without switching users:

For omd users: ``su``-root-c ``"ifconfig"`` requires a password

The difference between su and su-

Su -: will switch root users, and also switch user variables to root environment variables

Su: only switch root users, but the current environment variable is still the environment variable of the previous user

Thank you for your reading, the above is the content of "how to use su commands in Linux". After the study of this article, I believe you have a deeper understanding of how to use su commands in Linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report