Solved

Linux bash scripting

Posted on 2013-05-29
2
526 Views
Last Modified: 2013-05-29
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 172.28.78.86 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
0
Comment
Question by:atorex
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 39204338
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 172.28.78.86 "echo %sss ALL=\(ALL\) ALL >> /etc/sudoers "
0
 

Author Closing Comment

by:atorex
ID: 39204349
thanks, I figured it was something dumb I didn't have, thanks for the help.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
000webhost.com default error log 1 61
HOw To Install Docker on VMware Workstation 19 343
Disabling security updates Ubuntu 3 46
Enable SPF on IMSVA 6 24
Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question