Linux is a way to execute programs as other users.

  

On Linux systems, programs are generally run under the system user. Of course, other users can also run the program, but only through some settings to let the program execute in other users. This article will introduce Linux's way of executing programs as other users.

First, runuser command:

Overview: The runuser command runs a shell with an alternate user or group ID. This command is only useful for the root user.

Runs only with the session PAM hook and there is no password hint. If a non-root user is used and the user does not have permission to set the user ID, this command will fail because the program does not have setuid. Since runuser does not run authentication and account PAM hooks, it is lower than su.

The syntax is as follows:

Precautions for use: Use the runuser command, no password is required, and it can only be used under the root user.

two, su command

1. Overview: su command allows you to become a super-user or an alternative user (substitute user), deceive users (spoof user), user settings (set User) or switch user. It allows a Linxu user to switch the current user to the target user who knows the password, switching to include the running console or shell associated with it

Its syntax is shown below:

2. Switch to the root user: The su command will ask for the password of the target user. Enter su - in your shell command line to switch to the root user (you must know the password of the root user)

If the correct root password is entered, the ownership of the session (this should refer to the context of the current console — — translation) will be changed to the root account. Enter logout to exit a root login shell and enter the whoami or id command to verify the owner of the current session. Previous12Next page Total 2 pages

Copyright © Windows knowledge All Rights Reserved