Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [sudo]

sudo - Execute a command with superuser privileges.

0
votes
0answers
12 views

Question regarding sudo & crontab

I just created a script that is being run as a @reboot item in crontab -e. It runs two scripts...in order. One creates ramdisks and populates them, and another runs an executable that depends on ...
0
votes
1answer
27 views

sudo in bash script: Doesn't always wait for password

I have a simple bash script like this: #!/usr/bin/env bash sudo ./some_other_script_01 sudo ./some_other_script_02 When I execute this script, I always see the password prompt, as usual: [sudo] ...
0
votes
1answer
25 views

running curl with sudo results in a status code 301 (Moved Permanently)

i have a test server running on port 3062, i want to send it HTTP POST data using curl when i run the following command : curl -d '{"k1":"v1","k2","v2"}' -X POST http://localhost:3062 it works fine ...
1
vote
2answers
74 views

sudoers file not being used

In this shop root access is being handed out in a way that I'm not familiar with. See below. I have all the access I need, I was just wondering why the sudoers mechanism is not being used. I have to ...
0
votes
1answer
55 views

sudo: move: command not found [closed]

I wanted to automate installation of pycharm on my new Linux Mint 19.1 and everything works great until I use sudo move command. Whenever code goes to that line I get "sudo: move: command not found" ...
0
votes
0answers
17 views

Using Alias for allowing a user to delete in a specfic directory and not prompting for a password

Need to allow a single user to delete folders / files within one directory, I have tried a few ways with and without alias but both ways it either prompts for a password or allows the user to remove ...
0
votes
0answers
28 views

To get super user name in shell script [duplicate]

I am having a bash shell script (eg - test.sh). In this shell script I have below statements- sudo su - dbmanage echo `whoami` >>$LOGFILE when I execute the script by login with my account "...
0
votes
0answers
17 views

PHP shell_exec to run debian system service

I'm trying to control a system service with PHP's shell_exec function : shell_exec('sudo /usr/sbin/service icecast2 stop'); But the only way I can get it to work is by allowing ALL users root access ...
0
votes
1answer
22 views

Adding Sudo Permission to a user

I am trying to add sudo permission for a user to login as a different user. Currently I am looking for below scenario. For eg: If "Sam" need to login as "Scott" using sudo access then what are all ...
0
votes
0answers
15 views

sudo: error in /etc/sudo.conf, line 0 while loading plugin `sudoers_policy' [duplicate]

I was working on PHP (Laravel) project with FFMPEG and i was getting an error of Unable to load FFProbe, then i thought of assigning FFprobe to $USER:www-data then give the execution permission to the ...
0
votes
0answers
21 views

Different behaviours of sudo [duplicate]

I created a file with sudo like this: sudo touch abc.txt Which understandably set the owner to root. Now when I try to edit the file via vi using sudo, it works: sudo vi abc.txt #works But when I ...
1
vote
2answers
55 views

How can I change user inside function

I have a bash script on centos7, and I need to execute some commands as different user. But it seems sudo works as expected outside function and didn't work inside bash function. I run script as ssh ...
0
votes
0answers
24 views

Allow sudo su - only to one user

Allow sudo su - on visudo only to one or some users of a group that access by ldap For example, I have visually defined the following: % dev ALL = (ALL) ALL What I need is that only some users or ...
1
vote
1answer
56 views

Lockdown find command in sudoers with regex

I want to allow a service user to search for files via a dialog script, but lock down the find command via sudoers, so only one command including a regex is allowed. This exact command should be ...
1
vote
1answer
38 views

Bash and Sudo forking continuously, hidden fork bomb?

I am experiencing a frustrating problem where my bash and sudo programs seem to be replicating thousands of processes on Mac. I have searched for all kinds of ways to stop them. I don't know what to ...
2
votes
2answers
89 views

sudo never works. I have no permissions on my computer [closed]

I want to reinstall Linux Mint..... Many commands start with sudo and then apt-get or whatever. I am never able to get past this. Typical attempt: john@john-AY022AA-ABA-p6330f:~$ sudo apt-get ...
1
vote
1answer
77 views

Sudoers to remove password from specific commands

I'm having a bit of trouble with sudoers syntax. Long story short, I'm struggling with my graphics card and I recently found out that I can turn it on and off with a simple command (previously it was ...
0
votes
1answer
55 views

What do the lines for root, sudo and wheel in sudoers mean?

I am trying to understand the sudoers file, but I have a few things that I don't understand. This line: root ALL=(ALL) ALL Users in root on any host (what does host mean, can you give me the real ...
2
votes
1answer
29 views

How to safely pass password to a remote server to execute sudo commands

I have a very long bash script, at the end of it is a command to execute sudo commands on a remote server: 10 hours of local processing … ssh user@ip "sudo ls" I have set up ssh keys to connect to ...
1
vote
1answer
31 views

sudo Replace Current Process?

I have an interesting use case. I'm running systemd in a container to simulate a VM for testing purposes. I'm able to run systemd just fine, but I need my default user to not be root so that anything ...
0
votes
2answers
68 views

How to resolve sudo error in RHEL7

I am not able to use sudo, how to resolve this ? $ sudo vi /etc/fstab sudo: effective uid is not 0, is sudo installed setuid root?
0
votes
1answer
30 views

Remote overwrite crontab file with sudo

I'm trying to build a script that automatically takes a file on the remote server and replace with crontab file, but I get permission denied. My idea is to create a shell function for it: ...
0
votes
0answers
14 views

Sudo hangs to run software EastFDTD

As I want to run a program, I command it as below and then I fill in the password. Next it hangs, did not do anything. What I am suppose to do, reboot my pc and program or there are some tricks to ...
0
votes
1answer
55 views

How can I add a password into a “sudo” command?

I want to use When Gnome Scheduler to run this: sudo service fancontrol start As "sudo" needs a password, how can I add it into the command, so that it can be run successfully? Each time Mint ...
7
votes
1answer
205 views

Bash: how can I run `sudo -n true` in the background without interfering with `read`?

I have a long running Bash script that I don't want to run as root, but it needs root access periodically throughout. I solved this by asking for the user for the root password using sudo -v and ...
0
votes
1answer
104 views

Linux Mint 19 Tara - after update sudo is showing stars instead of nothing

I have Linux Mint 19 Tara and today I installed new updates of packages which you can see below in the picture. After that during sudo usage sudo shows * instead of nothing. Sudo works but this is ...
0
votes
1answer
40 views

How do I add an entry to the end of the line in bash [closed]

I have a sudoers file that I'm trying to add /usr/sbin/ifconfig at the end of a line. So what I'm trying to accomplish is this: devops ALL=(root) NOPASSWD: /usr/sbin/ifconfig, /usr/sbin/ethtool, /...
0
votes
1answer
27 views

sudo - How insecure is it to modify caching time? [closed]

We can modify sudo caching time with the option: timestamp_timeout How insecure is that? I wanted to increase it to several hours (the time of my sessions)
0
votes
2answers
26 views

Write a string to the file that only root can access when execute the php file

I have a case that require I to write some string to the file that only root can do that. I was try some solutions base on this post but none of them works. CASE: When user was successfully done, he ...
0
votes
2answers
58 views

Can I tell when I was given sudo access?

I'm on a Centos system. It was just created. My account has sudo access. The person who set up the system had to be reminded to do some basic steps and took a long time. I'm wondering if giving ...
3
votes
1answer
65 views

sudo escalation password fails - /etc/shadow hash ok, group ok, /etc/sudoers ok

After system update/upgrade, I cannot escalate with sudo using correct password: user $ sudo -s [sudo] password for user: ******************** Sorry, try again. [sudo] password for user: *************...
0
votes
0answers
55 views

Piping password multiple times to a command via the command line

I am running Ubuntu 18.04 with bash and I would like to pass a password to a command that runs with sudo, but once its run, i.e the password is piped into the command (a python3 command to run an app),...
0
votes
1answer
132 views

Privilege escalation with sudo vim

I have the following problem: I configured sudo with permissions for everything except for a few commands, remove, reboot, shutdown, block from sudo to shell, preventing a user from elevating the ...
0
votes
2answers
52 views

How do I switch users on Amazon Linux for EC2 instances?

I saw How to change to normal user in the command line when logged in as the root user? How to switch between users on one terminal? I have access to sudo. I tried [ec2-user@ip-172-99-99-99 Weekly ...
0
votes
0answers
32 views

remove program from local terminal

I tried to remove gfortran program from the local terminal windows by: rm -rf /usr/local/bin/gfortran but always I am facing the following : override rwxrwxr-x root/wheel for gfortran? I ...
0
votes
2answers
65 views

How to start weblogic service using sudo with another user?

On Centos 6.8 server, I need to start weblogic-service from test user, and I need the process owner to be weblogic, not the test user. I also have to start weblogic with nohup, and put it in ...
1
vote
1answer
38 views

Echo'ing into a file only works with root and not sudo [duplicate]

I have a directory /sys/class/leds/ with the file bananapro\:green\:usr/trigger that controls an (green) onboard led. The contents of this file just contains the modes for the led. As root, I can run ...
6
votes
2answers
320 views

Restarting systemd service only as a specific user?

I created some systemd services which basically works: location: /etc/systemd/system/multi-user.target.wants/publicapi.service content: [Unit] Description=public api startup script [Service] ...
1
vote
1answer
58 views

Have tmux not ask for sudo password for a process in session (authenticate beforehand)?

I have already seen [SOLVED] Why sudo asks for user password in tmux/ssh session? · GitHub Gist, and it looks like this is there by design, but I thought I'd ask anyways: Say I use a command like ...
1
vote
1answer
42 views

About macOS: why my user not in sudoers file but I can use sudo privileges too?

In Linux, if the user that you created want to use sudo privileges, you should add this user to /etc/sudoers(add something like jack ALL = (ALL) ALL). Well, the default mac user(the one you login to ...
1
vote
1answer
54 views

Give a user permissions to start, stop or restart shiny-server

I need to give permission to a user to start, stop and restart Rstudio's shiny-server. Right now, I have been managing the service upon this user's request with sudo service restart shiny-server, but ...
0
votes
2answers
69 views

How to preserve shell variables in script after changing user

How can I access same variables data after switching users? For example: artifact=archive.tar.gz workdir=/home/user echo "$workdir/$artifact" sudo -u otheruser bash echo "$workdir/$artifact" ...
1
vote
1answer
103 views

Add “domain admins” group in sudo users [duplicate]

I want to give access domain admins group to sudoers access. I have come across with many commands but nun of works for me. fname.lname ALL=(ALL) ALL With this command i can give access to a ...
1
vote
0answers
34 views

How to prevent automated message being printed every time I sudo, without changing global settings?

At my office whenever I log into a linux server I get a standard message which basically amounts to "You consent to us monitoring you if you use this machine". This has been required part of every ...
29
votes
1answer
2k views

Given that root has all privileges, why is root ALL=(ALL) ALL in /etc/sudoers? [duplicate]

I looked at this question: Trying to understand the difference between “modernNeo ALL=(ALL:ALL) ALL” and “modernNeo ALL=(ALL) ALL” in the sudoers file I still have a question. Since the "root" user ...
2
votes
2answers
70 views

Why is /etc/sudoers not world-readable?

I'm struggling to think what security risks there could be to knowing who is allowed to use sudo.
2
votes
0answers
40 views

Recovering from chown -R <user> /usr/bin [duplicate]

I ran chown -R <user> /usr/bin in arch thinking I could easily fix it if anything went wrong. Unfortunately, that has proven to be incorrect. As a result of this, startx won't run i3 ...
0
votes
0answers
37 views

Raising permissions of account “dummy” when executing command from “root” as “dummy”?

Context: While trying to execute command su a -c task as user dummy when being logged (with sudo su in as root on Ubuntu 16.04, I receive the following error message: root@DESKTOP-344ab:/home/dummy#...
2
votes
1answer
46 views

Keep access to a file after sudo

user1 runs sudo -u user2 SomeCommand. I want SomeCommand to be able to access the files of user1 (or just a specific directory or even a single file, if that's easier), without giving access to user2 (...
1
vote
1answer
75 views

Sudo installation problems

I just downloaded Debian 9.6.0 from osboxes to run it on a VM. However, I ran into a few problems. I can't sudo. Ok, you have to install it first. No problems... I thought. Turns out, there are a few ...