[LINUX] What do you roughly say "sudo su"?

Leave it as a memo for yourself.

Introduction

Now, I understand, but when I first operate the Linux OS, "Why is sudo su depressed?" "Why is there no su behind sudo this time?" "Well, this time. There is a- (hyphen) behind su? "And I was confused. There is a feeling of renewal now, but if you are a windows user, you will be asked "What is sudo su after all?", So I tried to summarize it in the sense of knowing the command properly.

What is the sudo command?

To execute the command following sudo as superuser (= root). In other words, only at that moment, you will have root privileges and execute commands. In summary, it will be "Execute the XX command with administrator privileges." It may be a little different, but is it like UAC on Windows?

#Use if you have a command you want to run as an administrator
sudo command

What is the su command?

The "su" that often follows sudo is a command. So what happens when you run the su command? The su command is a command to switch users. When this su command is executed, the subsequent operations will be performed by the switched user. If you compare it with windows, I think that you can switch users with Alt + F4 while the desktop is displayed. I think the su command is similar to that because it does not log off the currently signed account and signs in with another account (strictly speaking, it's completely different, but it's a rough concept. I think it's like that ...)

#Use when you want to switch users.
su Switch account name
#(Omitting the account name implicitly handles user switching as root (important))

As an aside, what about the "su-(hyphen)" command?

The su command may or may not have a- (hyphen). This is simple and when hyphenated, the option is to move the current directory to the switched user's home directory when switching accounts. Therefore, if you do not want to switch the current directory, do not add a hyphen.

#Switch user + move to the home directory of the switched user
su -Account name to switch

that's all.

Recommended Posts

What do you roughly say "sudo su"?
Python | What you can do with Python
What you can do with API vol.1
Data analysis, what do you do after all?
What you can do with programming skills
Let's summarize what you want to do.
What to do if you can't pipenv shell
What to do if you can't pip install mysqlclient
No module named What to do if you get'libs.resources'
ModuleNotFoundError: No module What to do if you get'tensorflow.contrib'
Links to do what you want with Sublime Text
What is pip and how do you use it?
What you can't do with hstack or vstack with dstack
What you can and cannot do with Tensorflow 2.x
What to do when you can't bind CaboCha to Python
[Linux] su, sudo settings
What Django renders do
[AWS] What to do when you want to pip with Lambda
What to do if you are addicted to Windows character code
What you can do with the Python standard library statistics
What to do if you get "coverage unknown" in Coveralls
What to do if you can't sort files with subscripts
What to do if you can't log in as root
What to do if you can't use WiFi on Linux
ImportError: No module What to do when you are told
What to do if you lose your EC2 key pair
[Python] What do you do with visualization of 4 or more variables?