How to access the linux touch command without permission, how to obtain root permission

foreword

When we use commands in Linux, the following situations often occur:

 When we open the root directory, we find that the permissions are not enough. When using the touch command to create files, permissions and time problems will also occur:

In fact, the root account on every Linux system is a super account with administrative privileges. Many tasks require logging in as root (or executing commands with root privileges). If you need to use the root user to perform tasks, a careless or malformed command (run as root user) may render the entire operating system unusable, such as rm -rf to force delete such commands need to be used with caution, of course, when needed How do we get root permissions?

Method: Use the root account to log in to obtain super privileges

root has a username ("root") and a password. If you know the root password, you can use it to log in to the root account from the command line.

First, enter the "su" command directly in the command line, su is super user, enter the set account password under this command to obtain super user privileges:

Note: Executing sudo passwd root on the command line requires the input of the current user’s password. There is no response on the interface, and the input line is blank. In fact, the system has accepted the password, but it is not displayed at the input place. It is different from the windows system, so just You need to enter a password, make sure the password is correct and just press Enter.

When logged in as root, you can also use a dash after the su command, as follows:

su -

This command will log into the system completely as root, it executes all root shell initialization scripts, and sets all environment variables.

Guess you like

Origin blog.csdn.net/weixin_52336311/article/details/119817861