The -S switch makes sudo read the password from STDIN. This means you can do . echo mypassword | sudo -S command to pass the password to sudo. However, the suggestions by others that do not involve passing the password as part of a command such as checking if the user is root are probably much better ideas for security reasons

-v Validate, sudo will update the user's timestamp, prompting for the user's password if necessary. This extends the sudo timeout for another 5 minutes (or whatever the timeout is set to in sudoers) but does not run a command. -- Indicates that sudo should stop processing command line arguments. The Bash task will find the first Bash implementation on your system. Running which bash on Linux/macOS or where bash on Windows will give you an idea of which one it'll select. Bash scripts checked into the repo should be set executable ( chmod +x ). From the man pages for bash and sudo it seems that the difference may be that sudo bash -l runs ~/.bash_profile, ~/.bash_login, and ~/.profile, and ~/.bash_logout of the root user, but from testing myself it looks like it runs the normal user's .bashrc and not the root one. I may have misunderstood which user the ~ expression is referencing in I have a bash function defined in a global bashrc, which requires root privileges to work. How can I run it with sudo, e.g. sudo myfunction. By default it gives an error: sudo: myfunction: comma Sep 12, 2019 · bash: /var/log/syslog: Permission denied There are several solutions that allow redirecting with sudo. The first option can run a new shell with sudo and execute a command inside that shell using the -c flag: sudo can log both successful and unsuccessful attempts (as well as errors) to syslog(3), a log file, or both. By default sudo will log via syslog(3) but this is changeable at configure time or via the sudoers file. OPTIONS sudo accepts the following command line options:

Once that's done when you enter a shell you'll be prompted for the 'chronos' password each time but you can then use 'sudo -i' or any other bash shell commands. If the above doesn't work for you and you can't gain access to a shell session then you'll have to 'powerwash' and start over, this time without enabling the Debugging Features.

bash profile works for user but not sudo - Ask Ubuntu bash profile works for user but not sudo. Ask Question Asked 7 years, 8 months ago. Active 4 years, 11 months ago. Viewed 28k times 9. I've modified my .profile to include a folder if a flash drive is plugged in. When running the command as the user it works fine but tells me the scrip must be run by sudo …

GitHub - imachug/win-sudo: Add `sudo` command to Git Bash

How to use sudo -i in a shell script - Unix & Linux Stack You can't use sudo in that way. The script would give you an interactive root shell and pause until you exited the shell. Then it would run the remaining commands in the script without root privileges.. If your script only does things that requires root privileges, then run the whole script with sudo: $ sudo … GitHub - imachug/win-sudo: Add `sudo` command to Git Bash The command is prompted twice. Though the same happens when calling just cmd, not sudo cmd.. To fix this, run sudo winpty cmd instead. (but you will have to run sudo winpty cmd //c "echo 1" instead of sudo cmd /c "echo 1"). Job support. win-sudo doesn't support jobs, so when running su or sudo bash you may get:. bash: cannot set terminal process group (7152): Operation not permitted bash: no Is `curl {something} | sudo bash -` a reasonably safe With curl | sudo bash, you get only the first if that; with rpm or dpkg you get some of them; with nix, you can get all of them. Using curl to download via https , you have some safety against a man-in-the-middle attacker, insofar as that attacker can't forge a certificate and key that's valid for the remote site.