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
26 views

Unable to run jar in directory as user

I have a user with sudo access, I am moving a jar file into another directory and then making sure the directory and its contents belong to that user before trying to run the jar as that user, for ...
1
vote
3answers
29 views

extract `.sh` scripts from a string and reformat them

I have a string like : %group1 ALL=(ALL) /ora/crs/oracle/product/crs/bin/gsdctl *,/ora/crs/oracle/product/crs/bin/vipca,/ora/app/oracle/ora/Root.sh,/ora/crs/oracle/product/crs/root.sh,/ora/crs/oracle/...
0
votes
1answer
26 views

Can I install a software on a Standard account in fedora without adding to Sudoer file or changing account type to admin?

I am working on Fedora 29 (64bit) and our company has a secure browser software where we provide standardized testing to millions of students across the USA. Right now we are stuck in a situation. ...
2
votes
0answers
51 views

shebang with /usr/bin/env and sudo

I hope the question is not too dumb, but I'm quite lost here because I don't see the solution (yet). I have lots of scripts, usually they start with a shebang and /usr/bin/env and the required ...
0
votes
1answer
17 views

setting up davfs2 to mount properly

I am trying to set up my nextcloud account so that i can log in. When I try to log in with sudo mount -t davfs2 ... it keeps on asking for my next cloud credentials - it does not get them from the ...
0
votes
1answer
13 views

Why does sudo xhost throw an error on openSUSE, but su -c xhost does not?

Here are some things that work: xhost su -c xhost su -c su `logname` -c xhost Here are some things that do not work: sudo xhost sudo su `logname` -c xhost sudo runuser -l `logname` -c xhost sudo -u ...
0
votes
0answers
16 views

How can I run sqlplus as nobody

I have a bash script (/bin/foo) where I export PATH, LD_LIBRARY_PATH, ORACLE_HOME, ORACLE_SID and I can run sqlplus (Oracle SQL client) from the script, but when I try to run it like this sudo -u ...
-1
votes
1answer
28 views

hidden files and directories warnings

I received these rkhunter results; what are these files, and are they dangerous? [23:17:48] Checking for hidden files and directories [ Warning ] [23:17:48] Warning: Hidden file found: /etc/....
0
votes
0answers
15 views

Red Hat 7 NOPASSWD for a specific script

Say I have a script called sayhi.sh at /usr/local/bin/ directory. And I have a user called tim who needs to run this script as sudo /usr/local/bin/sayhi.sh without the password. So I updated the /etc/...
6
votes
1answer
1k views

Sudo command gets executed as root instead of specified user

sudo -EH -u someuser nohup sh check.sh & Above commands runs the process as root instead of the user specified by -u flag. root 4056 2388 0 13:00 pts/4 00:00:00 sudo -EH -u someuser ...
-2
votes
1answer
31 views

Allow redirection for a user [duplicate]

I'm going to permit redirections ">>" and ">" for the www-data user in sudoers but I can't find this.
0
votes
1answer
24 views

check who can “sudo -u myaccount…”

is there a way if owner of an unix account (no root) can check which of non-root users are allowed to run commands as he, using sudo? /etc/sudoers is not readable. For my personal safety I'd like to ...
-1
votes
0answers
11 views

Promis Pegasus Media Storage failed

We run an Autodesk Flame on Mac OS X and we had some problems with the connection with the storage unit (Promis Pegaus). Flame1:~ mac$ sudo rm -rf/Volumes/Promis \ Pegasus* This command usually ...
0
votes
1answer
31 views

Exported Date Variable not appearing in subshell

I'm currently working on creating 2 bashes with two different scripts which result in two files named with the same timestamp for easy comparison/processing later. The date variable gets created in ...
0
votes
1answer
33 views

Ubuntu 16.04 root password suddenly not working(even after resetting) [duplicate]

I disabled password for login at User Account setting, and later when I ran sudo, I get "Sorry, try again." It seems my previous password doesn't work anymore. I also tried hitting enter directly but ...
0
votes
0answers
14 views

How to validate pbrun working or not but not really doing pbrun

I am developing and health check script for our application and we need to validate few things after every major change and/or patching . One of the checks is whether the pbrun access is working or ...
1
vote
0answers
20 views

unexpected behavior of 'rpm --setperms sudo'

rpm --setperms sudo on a fedora 29 fresh installation sets /usr/bin/sudo's permissions to 0777; i confirmed it by reinstalling sudo using dnf, which will correctly set the permissions to 4111 and then ...
0
votes
2answers
30 views

Open a tmux session and then change to different user without password prompt

I am trying to create a script that opens a new tmux session and then runs a command inside that tmux session as a different user. The purpose of this is to create a new tmux session for a game ...
3
votes
2answers
43 views

How to temporarily disable sudo credentials timestamp timeout?

Let's say, I have the following bash script: #!/bin/bash sudo command1 command2 sudo command3 I don't want to run command2 as root, so I won't run the script itself with sudo. Therefore, as soon as ...
-1
votes
1answer
20 views

difference between using sudo su - versus setting ALL in sudoer

I have an account which needs to execute all commands : should i provide su - command permission for the account or set "ALL" permissions on command. su - can elevate as root and run any command; ...
0
votes
0answers
8 views

How to prevent non-sudo-installable Conda app from being able to modify itself (and other such apps too)?

There is a Conda package manager that can create independent virtual environments. But the most economic and default way to use it is to let it create hardlinks for packages used in several ...
8
votes
3answers
850 views

Echoing a tail command produces unexpected output?

This command, when run alone, produces the expected result (the last line of the crontab): tail -n 1 /etc/crontab However, when I run it as part of an echo command to send the result to a file, it ...
1
vote
1answer
29 views

stop force save on a file with read only permission

I have a script file that is currently in sudoers, and for security I want this file to be read only... so I issued the following chmod: chmod 555 test.sh Now the permissions on this file are -r-xr-...
0
votes
2answers
53 views

Run command from sudo su

On a machine I (tlous) have been given access to open a shell as another user (serviceAccount) Executing: sudo su - serviceAccount has the desired effect of opening a shell as this serviceAccount ...
0
votes
0answers
45 views

Restrict certain command options [duplicate]

How can I restrict a user from executing sudo -su? I.e., disable this -su option for sudo allowed users.
2
votes
0answers
39 views

Small delay in sudo

I want my zsh prompt to display whether the session has sudo rights (from a previously run sudo command). After looking at the answers to this question, I arranged to use the exit status of sudo -n ...
0
votes
2answers
343 views

sudo command not found

I got my init.sh file for installing seafile. When calling: if [ ! -f /config/init_completed ]; then ... else # start seafile sudo bash ${INSTALLPATH}seafile.sh start sudo bash ${...
3
votes
1answer
41 views

What is Date_Spec in sudoers policy?

I was reading through the sudoers policy manual. Under 'User specification' section, I saw Date_Spec as part of the Option_Spec, in turn an optional part of the Cmnd_Spec. User_Spec ::= User_List ...
1
vote
0answers
64 views

How to get the average CPU usage over the past 10 seconds in bash?

I need a command that would echo the average CPU usage over the past 10 seconds in Ubuntu 18. Each of the following conditions must be met: It must be lightweight with a very small footprint, ...
1
vote
1answer
124 views

Sudo: “Operation not permitted” when program is started as a service, but working when manually started. Why? [closed]

I need to be able to exec a command as sudo (e.g. sudo echo 'toto') in a custom go program. I've added my user in /etc/sudoers and it works just fine, when I login as my user and run the program ...
0
votes
1answer
62 views

How to avoid password prompt when starting Synaptic?

Whenever I start the Synaptic package manager, it asks for a password. How do I make it skip that dialog? I'm using Debian 9.8.
-1
votes
2answers
80 views

sudo without sudo, implying sudo in script

I made some scripts containing some functions which by design needs sudo permission. I have added those path in .bashrc for Linux and .bash_profile for MacOS so that it can be called from anywhere. ...
0
votes
0answers
36 views

Is there any method to install packages in centos without using sudo or yum command?

Am looking for a method through which I can download and install packages without a sudo. What I really would like to know is the method which permits me to install packages without super user ...
0
votes
0answers
16 views

what is the difference between `sudo su - <username>` and `sudo -iu <username>` [duplicate]

they both log you in as <username> and that the first involves using running su as root while the second does not involve the su command but I am wondering what are the differences to both? is ...
-1
votes
1answer
35 views

`byobu` window with `sudo su -` [closed]

Sorry for the cross-posting across the fora. I am not sure if my original post was in the correct forum. I am aware that what I would like to do is not safe... I would like to open a window in my ...
1
vote
2answers
52 views

Running a custom command with sudo doesn't work

I've made a custom command in bash and I placed it in ~/.local/bin which is a path loaded by the ~/.profile. When I run the command through a terminal without sudo it's fine, but when I try to run it ...
1
vote
1answer
226 views

Ubuntu - “sudo iptables” command works in terminal, doesn't work in bash script

I'm using a simple terminal command that adds a rule to iptables and it executes without problems: sudo iptables -A OUTPUT -p tcp -m string --string "facebook.com" --algo kmp -j REJECT When I run ...
-2
votes
1answer
60 views

Can't grant myself permissions to use the rm command

I have a user account on my machine: $ (whoami) foo_user I've updated by /etc/sudoers file to grant myself permissions to use the rm command: User_Alias OPERATORS = foo_user Cmnd_Alias RM ...
2
votes
0answers
52 views

Unable to run 2 sudo commands without asking password from script

I want pacman to check for updates on system startup without asking me for password. I created a script ~/bin/startup which is executed through ~/.config/i3/config. In ~/.config/i3/config: exec_always ...
0
votes
0answers
63 views

Terminal - Password suddenly “visible” in asterisks [duplicate]

I did not change anything, and suddenly, when typing my password into the terminal during "sudo" commands, my password length is shown in asterisks as i type. Is this a feature of a new mint cinnamon ...
1
vote
2answers
45 views

Pasting multiple lines so that they consistently execute

Here's an example of a very simple code snippet that I'd like to paste to my terminal in a way that everything is executed. sudo apt update sudo apt upgrade sudo apt -y install build-essential sudo ...
19
votes
3answers
3k views

What's the purpose of “true” in bash “if sudo true; then”

I've hacked together this bash script which tests if the user has superuser privileges and if they don't it asks for them. Ultimately I'm trying to invert the second 'if' statement so that I can ...
6
votes
2answers
848 views

Why doesn't root need the password to run “sudo” even when “NOPASSWD:ALL” isn't written in /etc/sudoers [duplicate]

In /etc/sudoers, there is always: root ALL=(ALL:ALL) ALL However, the root user (with UID 0) doesn't need to enter password when they run sudo command. For other users, a password is required ...
0
votes
1answer
45 views

Is there a way for bypassing the usage of prefix 'sudo'

I am able to execute all the by using the prefix sudo. As of now I was able to remove the password dependency for user qedbuser. I would like to not use the word sudo. One my application is trying ...
0
votes
0answers
58 views

OSX SFTP with Sudo?

I have been given access to a server to do some legacy development work. The server is running RedHat Enterprise Linux 6 as its OS. To access this server, I must first SSH in with my username/...
0
votes
0answers
16 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
47 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
73 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
117 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
79 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" ...