0

I have a script that is run by root and looks like this

curl -O some stuff
mv it to user guest directory
su - guest -c sh /home/guest/script.sh

Everything works fine until the last su command. It gives me the error

sh: cannot set terminal process group (-1): inappropriate ioctl for device
sh: no job control in this shell

How can I make the user guest execute the script.sh using su?

1 Answer 1

1

From man su:

SYNOPSIS
su [options] [-] [user [argument...]]

You changed the order of the parameters. Try this way:

su -c "/path/to/sh /home/guest/script.sh" - guest

Note the quotes " before the start and after the end of the command. Moreover, I suggest you to use absolute path also for sh.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.