Skip to content
Advertisement

Tag: sudo

what alternative methods for sudo echo without bash -c

I must run the echo in the script my.sh with sudo because permission. I do not want to execute the script with sudo my.sh. I do not want to use bash -c “…” because escaping. Are there no other solutions? my.sh Answer The problem you are encountering here is that the output redirection >/file.tmp has to happen with elevated privileges.

Sudoers.d file is not picking up in SLES SP5

I was working with some Linux service file and in one scenario I need to invoke systemctl command as a different user say sar user. So I have wrote one sudoers file(/etc/sudoers.d) and added the following code and I am invoking the command using sudo prefix its working for the most of the Linux version but in SLES 12 SP5

Django – can’t run server as sudo

I’m creating a soft AP in order to configure my raspberry wireless from it. I alread have an script to create a hotspot, a dhcp server and now i need to run a django app using sudo. (Yes, using sudo. I’m waking up my django server from my python script, and the script needs to run as sudo) I’m getting

Cannot execute command as another user with sudo

I have this code, that is running on tomcat: And my script.sh file: From command line, the script is executed excellent and I see results. But when executing it from tomcat I get this message: I cannot solve this problem. I need your help. P.S: Sorry me for bad english. Thanks! Answer I guess that the problem occurs because the

issue in logging in as sudo user

here is the script sample.expect : expecting to log into the host as sudo user. but getting issue [sudo] password for USER: invalid command name “sudo” while executing “sudo” invoked from within “expect “[sudo] password for USER:”” (file “sample.expect” line 6). Answer That uses square brackets, which are Tcl’s mechanism for command substitition. You have to either escape the leading

Why can’t I sudo echo a line in /etc/?

I am on centos and I did sudo echo ‘testline’>>/etc/test/test it said -bash: /etc/test/test: Permission denied However, when I do sudo vi /etc/test/test and insert testline and do :wq it writes out fine, why is this happening? Answer You need to wrap the whole statement (including the redirect) into a group so the sudo extends around it. Note: that, too,

python3 import error: while running with sudo -u python3

For my python script I need to change the user. Therefore I start the script with: sudo -u eval python3 run_aufgabe2.pythere is no problem running the script until I import modules from the same directory, then I get an import-error: Running the script without sudo -u eval, the import is working and the script is running without errors. I first

preserve inline variable with sudo

Hi i’m trying to make something like this to work in bash but i keep getting an empty line, the only thing that works so far is: what i would like to achieve is the ability to inline a variable for the sudo command i also tried this as suggested here but with no luck, am i missing something? Answer

Advertisement