I'm struggling with running the following command:
ssh someuser@lab-test "sudo /usr/local/scripts/user.sh add tstt7777 177700007 \"Test User 06\" "
Long story short I need to run the user.sh script with ROOT privlages as someuser from a remote machine. However I do not want someuser to be able to run ANY other commands, open a shell or otherwise have access to the system. The user needs only to run that script with multiple dynamic arguments.
I've handled the public key exchange already, and I've added privlages in sudo:
#Sudo
someuser ALL = NOPASSWD: /usr/local/scripts/user.sh
But I get the following error:
sudo: sorry, you must have a tty to run sudo
I've looked at the "Command=" function in ssh but my understanding is that this will only run the command specified and won't allow arguments to be passed as indicated in my invocation.
Is there something I'm missing to make my method work via sudo?
Is there a better method that I haven't considered in SSH or BASH?
Run visudo and comment out as below:
Simply add the -t ( pseudo-tty )option along with the ssh command.