Running a Linux command as another user

Consider running a command from the console with the rights of another user.

There are at least three ways. But the more ways there are, the easier it is to forget them. For this reason, below there will be one way through su

If the directory is not important, the command will be run from the section, the root access to the folder of which is allowed for this user:

Those. this user will start, for example, not inside / home /, but at the level of, for example, a site – / home / web / sait

Between the quotes, the command to run. admin – the user with whose rights we run the command.

Or if you need to save the directory from which the command is run (remove the dash):

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *