Linux bash scripting

Can someone help me with this issue Im having, I have a script to deploy new users and create a new group that will have sudo rights. I have the script ready and Im having issues with one line as per below
echo "## SSS user group sudo rights >> /etc/sudoers" & echo "%sss ALL=(ALL) ALL" >> /etc/sudoers

if I execute this locally it works fine but if I have it executed from an ssh session on a script I get an error like below

E420S ag # ssh echo "%sss ALL=(ALL) ALL" >> /etc/sudoers
bash: -c: line 0: syntax error near unexpected token `('
bash: -c: line 0: `echo %sss ALL=(ALL) ALL'

appreciate any help
Who is Participating?
woolmilkporcConnect With a Mentor Commented:
ssh swallows the quotes, so you must escape the parentheses.

Besides that, you'll have to place the output redirection inside the quotes, otherwise you're going to create a local file!

ssh "echo %sss ALL=\(ALL\) ALL >> /etc/sudoers "
atorexAuthor Commented:
thanks, I figured it was something dumb I didn't have, thanks for the help.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.