How do I edit /etc/sudoers from a script?
Old thread, but what about: echo ‘foobar ALL=(ALL:ALL) ALL’ | sudo EDITOR=’tee -a’ visudo
Old thread, but what about: echo ‘foobar ALL=(ALL:ALL) ALL’ | sudo EDITOR=’tee -a’ visudo
Nevermind, I just found the answer in the alt-text at xkcd: Replace root with your username, in my case ryan, so the log is found with: cat /var/spool/mail/ryan
try running: su -c “Your command right here” -s /bin/sh username This will run the command as username given that you have permissions to sudo as that user.
For sudo there is a -S option for accepting the password from standard input. Here is the man entry: -S The -S (stdin) option causes sudo to read the password from the standard input instead of the terminal device. This will allow you to run a command like: echo myPassword | sudo -S ls /tmp … Read more
I also saw this change on my Mac when I went from running pip to sudo pip. Adding -H to sudo causes the message to go away for me. E.g. sudo -H pip install foo man sudo tells me that -H causes sudo to set $HOME to the target users (root in this case). So … Read more
For your command you also could refer to the following example: sudo sh -c ‘whoami; whoami’
I answered this question on SuperUser but only after the OP disregarded the unhelpful answer that was at the time the only answer to the question. Here is the proper way to elevate permissions in Cygwin, copied from my own answer on SuperUser: I found the answer on the Cygwin mailing list. To run command … Read more
Much simpler: use sudo to run a shell and use a heredoc to feed it commands. #!/usr/bin/env bash whoami sudo -i -u someuser bash << EOF echo “In” whoami EOF echo “Out” whoami (answer originally on SuperUser)
Ok it looks like NPM is using your .gitignore as a base for the .npmignore file, and thus ignores /lib. If you add a blank .npmignore file into the root of your application, everything should work. A better, more explicit approach is to use an allow-list rather than a disallow-list, and use the “files” field … Read more
The nice thing about Tramp is that you only pay for that round-trip to SSH when you open the first file. Sudo then caches your credentials, and Emacs saves a handle, so that subsequent sudo-opened files take much less time. I haven’t found the extra time it takes to save burdening, either. It’s fast enough, … Read more