P
P
Printip2017-01-26 02:25:26
linux
Printip, 2017-01-26 02:25:26

How to run .sh script as root while under another user in one line?

We have user user.
Switching to root is done with the su command.
Task: run the /home/run.sh script from the terminal with one command as root while under the user user.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yuri Chudnovsky, 2017-01-26
@Printip

have you tried reading man su?
su -c /home/run.sh

E
Eugene Wolf, 2017-01-26
@Wolfnsex

sudo or suid will do?
PS suid on shll-scripts in the vast majority of cases - does not work... Thanks comrade. jcmvbkbc for details.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question