Questions tagged [sudo]

1

votes
1

answer
61

Views

python: subprocess gives me different results while using sudo

I'm using python to do some tests and I get a very weird issue as below: First I have a simple bash script named 1.sh: #!/bin/sh echo 'NOTHING' Then I make such a python script named test.py in the same directory as below: #!/usr/bin/python import subprocess import os os.environ['PS4'] = 'aaa ' res=...
Yves
1

votes
1

answer
279

Views

Sudoers command with wildcard arguments doesn't match 0-length arguments

I need to allow a set of users to run, as a different user, a command with the following structure: command [args] subcommand [subargs] both args and subargs should be optional. I this tries whitelisting the following in sudoers: /path/to/command * subcommand * However, this only works if both args...
Jeff Hemmen
1

votes
0

answer
86

Views

How to correctly elevate privileges in Visual Studio for Mac

Using .NET Core 2.1.4 on High Sierra, I have the following code: using System; using System.Net.Sockets; namespace socketTest { class Program { static void Main() { var udpSock = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Udp); Console.WriteLine($'udpSock object is: {udpSock...
Hyperfine
1

votes
1

answer
525

Views

“sudo” command executed with JSch requires password, even when the password is not required in an interactive SSH session

From Linux command shell I can make SSH connection to our CentOS machine using user ABC. After successful SSH connection, I can run sudo command and no password is required. sudo /usr/bin/rootsh -i -u root In JSch program, I make am SSH connection using user ABC and then execute the above command, b...
user3027786
1

votes
0

answer
526

Views

sudo rm not working on Mac

I am using ccache and it is stuck in a state that blocks all builds that use it. I tried doing ccache --clear but the command simply hangs, so I went ahead and decided to delete the .ccache folder manually but I am getting 'permission denied'. stat output for one of the files: 16777221 8590811525 -r...
Makaronodentro
1

votes
0

answer
449

Views

In flask, os.environ.get() return None

I want to get th variable TOKEN from my environment in Flask config.py: *config.py:* TOKEN = os.environ.get('TOKEN') So i export TOKEN=666 Then: $ sudo python3 manage.py shell >>> import os >>> os.environ.get('TOKEN') >>> quit() It return None. After i read this -->os.environ.get() does not return t...
Lainly
1

votes
0

answer
74

Views

php exec sudo -u root … uses another username

I'm positively stumped with a problem that escapes me entirely - and I can't seem to find any documentation specific to it. I just recently switched to php7.1 to refactor a webapp that's been running for years on php5.3. In the old version I use things like exec('sudo -u root -S some_command < /pat...
Engle
1

votes
0

answer
160

Views

jsch multiple command using sudo

need to login with my id, execute below command sudo su - tstusr execute the script : ./app/t1.sh status String sudoCommand ='sudo su - tstusr'; List commands = new ArrayList(); commands.add('./app/t1.sh status') try { channel = (ChannelExec) session.openChannel('exec'); channel.setPty(true); cha...
Rajar R
1

votes
0

answer
405

Views

How to run python setup.py on windows with apt-get and sudo commands?

I'm using Windows 10 and trying to run python setup.py on cmd, it is able to run the pip commands but not sudo and apt-get saying it doesn't recognize the command and internal or external and ends the message with Traceback (most recent call last): File 'setup.py', line 17, in a,b,c = version.spl...
Sebastián Soto
1

votes
2

answer
258

Views

Remember root password throughout script using Bash

Background I have a long bash script which setup a large environment of interconnected software, taking several hours to complete. A few of the tasks it performs need to be run as root, for which I use sudo .... The whole process is then paused until the user notices and types in the root password....
jmd_dk
1

votes
0

answer
173

Views

Can not install cocoapods because of the password on Mac desktop

I have been trying to install using the command sudo gem install cocoapods on my desktop with OS. X High Sierra. After entering the command, it asks for the password. I enter an administrator password and it replies 'Sorry, try again'. Also, by the password, I see a sign of a key. Does it mean it...
Sergey_yaklichk
1

votes
0

answer
62

Views

How to add new repository in CentOs

I am trying to install readR package from R on EC2 instance. I found a solution on this post: I would like the script for CentOS but the answer is for Ubuntu: [1] apt-get update # refresh [2] apt-get install software-properties-common [3] add-apt-repository -y 'ppa:marutter/rrutter' [4] add-apt-...
ML_Enthousiast
1

votes
0

answer
21

Views

Python: Unicode error when passing password to sudo using subprocess.Popen.communicate

I have a tkinter Python 3 program that needs sudo privileges, so it checks for that and if you don't have it, it'll ask for your password and then rerun the program with sudo. My current code works when just running the code like, python3 myscript.py, but if I compile the script with python3 -m py_c...
FrailOtis
1

votes
1

answer
116

Views

command not found even when “which” shows its path with sudo

I'm on Fedora release 25 with zsh 5.2 I am trying to use a command with sudo. (In this example, docker-compose) Problem: which command shows where it is. $ sudo PATH=$PATH which docker-compose /usr/local/bin/docker-compose In spite of that, command not found $ sudo PATH=$PATH docker-compose sudo:...
Physickelback
1

votes
0

answer
220

Views

react-native run-android giving error without sudo on mac

How to run react-native without sudo on Mac? It give me this error every time permission denied. Is there any solution to run it without sudo? Error log EACCES: permission denied, open '/Me/newone/cc-react- native/node_modules/react-native/scripts/.packager.env'
Amjad Mehmood
1

votes
3

answer
1.6k

Views

Can Ansible use “sudo su -” if the sudo user is not allowed to run arbitrary scripts?

I am trying to use Ansible to automate software installation and setup on several remote machines. My personal user account on the machine is locked down, but I can use sudo su - to become the root user when I log in manually. Once I'm the root user, I can run things like yum install git and similar...
nwinkler
1

votes
1

answer
120

Views

Recording pulse audio as CAP_SYS_ADMIN with ffmpeg

As my normal user, this works: ffmpeg -f pulse -i default -acodec aac foo.aac but run with sudo is fails with: default: No such process How can I run ffmpeg as a privileged user (CAP_SYS_ADMIN), since I am keen to use the kmsgrab option and still get access to sound in order to record it too?
hendry
1

votes
1

answer
455

Views

sudo: npm: command not found in WSL

I'm trying to install globally some packages for my Unix environment on Windows with WSL. I use nvm to manage the different versions of Node.js. The problem is while using the sudo command before a global npm install : sudo npm install --global prompt-pure I get an error: sudo: npm: command not foun...
jmpp
1

votes
0

answer
74

Views

Request administrator rights from inside a Python script mac OS

There was a need to write a script on Python, editing system files. The problem is that macOS does not allow to edit these files without administrator rights. Q: how can I request administrator rights inside the GUI program? That is, user runs the program by double-clicking, the program asks for a p...
garbart
1

votes
0

answer
70

Views

run commands in UNIX server as root user using sshg3 or batch file

I am using tectia tool for ssh. I am giving 'sudo su -' command to become root user in the tool (it not asking for a password). but , where iam trying to run the commands through batch file iam not able to become root user ' iam getting user not allowed to run as root' sshg3 -b [email protected] < c:\\file....
Y Manikandan
1

votes
0

answer
133

Views

Bump: sudo gcore gives 'insufficient privilege' on a chrome tab process

Original post August 21, 2018: sudo gcore gives 'insufficient privilege' on a chrome tab process I am only user on this macbook pro (high sierra) so I'm the only administrator. Anytime I go into terminal and type 'gcore PID' or 'sudo gcore PID' I get the following:'gcore: insufficient privilege'. (...
Nick
1

votes
2

answer
761

Views

what is the equivalent in windows to the SUDO command to move a phar file

I understand that sudo is not availble in windows i want to move a phar file from a directory to sudo mv wp-cli.phar /usr/local/bin/wp i am following instructions from this site; installing word press for command line so, i am unclear whether i can just manually do it or need to use the sudo command...
Paul Kendal
1

votes
0

answer
418

Views

Sub-process /usr/bin/dpkg returned an error code (1) with sudo apt-get -f install

Observing following error with sudo apt-get -f install Found kernel: /boot/vmlinuz-4.4.0-21-generic Found kernel: /boot/memtest86+.bin run-parts: /etc/kernel/postrm.d/x-grub-legacy-ec2 exited with return code 10 Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-4.4.0-134-gener...
Pooja
1

votes
2

answer
163

Views

Ros Environment in root

I have a ros (kinetic) environment set up on a raspberry pi 3 and am trying to get ros to execute upon startup via a simple bash script which calls roslaunch. Ros works in the user domain but fails when called from root. Here is my launch_ros.sh script: #!/bin/bash source /home/pi/ros_catkin_ws/deve...
Cal Dilworth
1

votes
2

answer
122

Views

Ansible sudo run (“as root”) on Cygwin

Need to run bash-script at sudo-user on remote hosts using Ansible. My working machine is Win10 + Cygwin (sorry, it wasn't my fault). So, i tested it on non-sudo scripts (it doesn't need root access) - and it works. No, first time it didn't work at all: Failed to connect to the host via ssh: my_user...
Antispam Antispam
1

votes
0

answer
25

Views

centos7: run .sh script from php (sudo)

i want to run a script from php like root user so in php i use this $output = shell_exec('sudo /usr/bin/sh /var/www/kill.sh'); echo '$output'; now in centos7 i run vim /etc/sudoers and at the end of the file i pasted this apache ALL=(ALL) NOPASSWD: ALL then i restart: systemctl restart httpd but i...
Gloytos htyqo
1

votes
0

answer
196

Views

`Could not install packages due to an EnvironmentError: [Errno 1] Operation not permitted` in the virtual envinronment

I tried to make a python virtualenvironment using virtualenv in I type virtuelenv env --python=python3 I get an error PermissionError: [Errno 1] Operation not permitted: '/mnt/d/venv/bin/python3' So I used the command with sudo and therefore type sudo virtualenv env --python=python3 The command wo...
Shashwat
1

votes
0

answer
42

Views

launching script with sudo from java program

I have a requirement where I need to run a script in ubuntu with sudo on click of a button in swing UI. In mac I just use the open command with Runtime.getRuntime.exec('open appname.app') and it launches a terminal asking me for the password and executes the script but in linux it doesnt work that...
Abbas
1

votes
1

answer
34

Views

Notify-send not working in python script run with sudo

I'm writing a python script that is run with sudo permissions. At some point, I would like to send a notification to the user. I have noticed that notify-send does not work as a root user, so I tried to run it as the actual user by doing su $SUDO_USER -c notify-send ..., but this does not work eithe...
derkomai
1

votes
1

answer
57

Views

Run shutdown command inside bash script

I'm trying to make an executable file (bash script) to show me a notification and shutdown my computer when a process is not found. I will run the script as a Startup Application and I'm using the notify-send and shutdown commands in this script. The problem is: (1) If I add myfolder/myscript to t...
Vinícius Valente
1

votes
0

answer
36

Views

“E: Invalid operation update” error while running shell scripts in WSL

I have a shell script called setup_wsl.sh which contains: #!/bin/bash echo 'hai' sudo apt-get update sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo apt-ke...
AnjanaDyna
1

votes
2

answer
47

Views

Azure CLI aks install cli permission denied and sudo does not work

I'm trying to run az aks install-cli but I get an error that says Downloading client to '/usr/local/bin/kubectl' from 'https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl' Connection error while attempting to download client ([Errno 13] Permission denied: '/usr/...
Kathrine Stack
1

votes
3

answer
804

Views

changing search-dirs for $ sudo gcc

On OS X I'm trying to install the zlib prerequisite for haskell's Cabal. I get this error: $ sudo ./Setup build Preprocessing library zlib-0.5.0.0… ld: library not found for -lgmp collect2: ld returned 1 exit status linking dist/build/Codec/Compression/Zlib/Stream_hsc_make.o failed command was: /...
Eric Wright
1

votes
3

answer
1.5k

Views

changed sudo path, command continues not being found

I added export PATH='/home/deltrem/Pedro - Arquivos/play/ps1/linux/pSX:$PATH' to /root/.bashrc , but sudo pSX echoes command not found.
Delirium tremens
1

votes
3

answer
741

Views

sh/expect/sudo/screen all needed together in one command

What I need to have happen: PHP needs to launch an server app which has root permissions running in the background. All of this should be silent. -Sudo is needed to allow php to perform an op that requires root permissions. -Screen is required to allow the app to run outside the scope of the webpage...
conartist6
1

votes
1

answer
768

Views

How to abort python fabric run command?

run('if [ -d data.bak ];then mv data.bak data;fi;') sudo('....') sudo('') I am using fabric deploy for my web project. I want to find a way that will stop the rest of the execution of the command, if it doesn't find the data.bak directory. Any way to achieve this in fabric?
mlzboy
1

votes
3

answer
7.3k

Views

How to sudo as a different user inside a script?

I have a wrapper script which calls two scripts aaa.sh and bbb.sh. These two scripts should be executed as different users as sudo -H -u user1 . /user/bin/scripts/aaa.sh sudo -H -u user1 . /user/bin/scripts/bbb.sh but the sudo command can't be executed inside a script. Need help...
Balualways
1

votes
1

answer
198

Views

sudo has different environments, why?

I realize that: sudo -i env is different from: sudo -i sudo env They are both sudo, why are they different? In my case, I realize the PATHs are very different, so sometimes things can't run with 'sudo blah' but it works when I first log into sudo, then run the command. (Like my other question #49766...
foobar
1

votes
1

answer
138

Views

User/permissions issues and PHP single-file installers

Since hearing about __HALT_COMPILER in PHP, I've been doing some experimentation with a single-file PHP installers (scripts containing a compressed archive of a filetree for a webapp). It seems to be easy enough to generate a script that contains both the archive and the logic for unpacking it and...
Weston C
1

votes
4

answer
851

Views

No permissions as “sudo”

I'm trying to compile something in OpenSuse however I get a Permission Denied. I've tried with 'sudo make' and even logged in with superuser but the same error persists. How can I fix this? Thanks.
Luís Jesus

View additional questions