How To Change User In Linux Shell Script?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can change user in Linux shell script using the su command. This can be done as follows:
su – [username] –c “your_command“
For example, to change user to john, type the following command:
su – john –c “echo hello“