On Ubuntu 14.04, a cron job is running a bash script that has to include sudo commands. VISUDO was properly edited to allow ALL=(ALL) NOPASSWD. However, the script keeps failing due to lack of sudo permission. How can that be fixed?
-
-
Answer:
If must be run as root, and you have already privileges to edit the sudoers file (so you probably have already root access), why not put that job as root/system cron job? If anyway you want to put it in your user crontab, checked running the process manually as that user? It runs without asking password?
Gustavo Muslera at Quora Visit the source
Other answers
If it is a modern system, like Ubuntu 14 is, you can try running the following pkexec visudo
Jarvis Jones
I like Gustavo's Answer. However if you want to run as a user, be sure to put fully qualified paths for all commands as cron does not inherit a User's environment. Also, it might be helpful to see the actual sudoers file entry. If you did not specify "all" without a password then you may have restricted the permissions too much. Also I don't know if you have SELinux enabled. You might want to disable it and relable the disk to see if this has any effect. You might have to tweak SELinux permissions if it is enabled.
Dave Ruedeman
Thank you all for your time and good suggestions.
Shay Ginsbourg
Related Q & A:
- How to call a function with parameter in a bash script?Best solution by tldp.org
- How to install Ubuntu 9.04?Best solution by Server Fault
- Will a current job appear on a background check if I do not put it on a resume/application?Best solution by eeoc.gov
- What is a Nurses job like in a hospital?Best solution by nursingworld.org
- How can I watch youtube on ubuntu 10.04?Best solution by clickonf5.org
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.