Reputation: 67
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
?
Upvotes: 0
Views: 299
Reputation: 977
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
.
Upvotes: 1