L
L
Leonid2022-03-25 22:28:20
linux
Leonid, 2022-03-25 22:28:20

How to login as a different user in a bash script?

I rummaged through a bunch of questions with a similar name, but they ask how to log in as a different user and execute some command in a script. I'm interested in whether it is possible to somehow make the user run a script that logs in the user who launched the script under another user? Those. a person logged into the system under user1, runs the script, the script works out and the person ends up in a session under the account user2

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2022-03-25
@ky0

Make an alias to sudo -i -u user2.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question