I have a user called ‘jose’ in a remote server and this user has full sudo access, but we were not provided with the root password of this remote server since the ‘jose’ user has the full sudo access. I need to add an entry to the /etc/sudoers file in the remote server by running a script/command in my local machine.
Command used: ssh email@example.com ‘sudo echo “ashira ALL=(ALL) NOPASSWD: /bin/su - a” >> /etc/sudoers’
I get the error: bash: /etc/sudoers: Permission denied
Also tried the command: ssh firstname.lastname@example.org sudo -i ‘sudo echo “ashira ALL=(ALL) NOPASSWD: /bin/su - a” >> /etc/sudoers’
But same error is shown.
Can someone help me how to add an entry to the sudoers file by connecting to the remote server with the user ‘jose’ ?
P.S: Finally I added this entry by logging into the remote server manually. But there are hundreds of servers I need to add this record. So Please help me on what command should I execute to do this task.