Stack Exchange Network

Stack Exchange network consists of 174 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.

2
votes
1answer
44 views

Why I can not drop sudo root privileges?

I am debugging a program and not quite sure why I can not drop privileges. I have root permissions via sudo and I can call setgid/setuid, but the operation [is] is not supported. Basic code to ...
-3
votes
1answer
27 views

Cannot Install anything on Kali Linux 2018 [duplicate]

root@Kali:~# echo -e "deb http://http.kali.org/kali sana main non-free contrib\ndeb http://security.kali.org/kali-security/ sana/updates main contrib non-free" > /etc/apt/sources.list root@Kali:~# ...
1
vote
1answer
25 views

Sudoers: can't run two command lists where the second has a glob * and denies the first

What I want is: to be able to run /sbin/print/managequeue.sh -p app1 --view as another user without asking for a password. to be able to run /sbin/print/managequeue.sh -p app1 --cancel (or --delete, ...
0
votes
1answer
16 views

Weird problem with CUDA installation

I am experiencing a rather unusual problem with my CUDA installation on Linux Mint 18.3. After a clean reboot, running deviceQuery as a standard user: optirun ./deviceQuery returns FAIL, but if I do: ...
0
votes
1answer
12 views

Homestead run command as root

Over my Homestead configuration, I try to make my after.sh script to auto-configure xdebug so over a box update or re-creation to be able to enfroce my configuration for it without the need to redo it ...
17
votes
3answers
2k views

Setting up passwordless sudo on Linux distributions

I recently set up both Fedora 28 & Ubuntu 18.04 systems and would like to configure my primary user account on both so that I can run sudo commands without being prompted for a password. How can ...
-1
votes
0answers
15 views

sudo: unable to initialize policy plugin

I run a sudo command via the python subprocess.check_output function. This used to work several month now. All or a sudden, it fails with: sudo: PERM_ROOT: setresuid(0, -1, -1): Operation not ...
0
votes
0answers
27 views

How to run ip netns exec without password?

I'm on arch and am using a network namespace wiredlan for ethernet, using it for LAN based applications and big downloads. I run commands/apps on the netns as: alias runonlan='sudo ip netns exec ...
-4
votes
0answers
44 views

Sudo command not found after using PS1=“1” ; export PS1 [closed]

I mistakenly used PS1="1" ; export PS1. Since then I am getting error sudo command not found. I can't even install sudo using yum install sudo because it needs root privileges and the sudo command is ...
1
vote
2answers
73 views

Deleted /etc/pam.d/common

I deleted all common-* files in /etc/pam.d folder and now I am locked out. I am running Ubuntu 14.04. I did backup all these files in a folder inside pam.d but now I can't even move them. If I try, ...
-1
votes
1answer
44 views

How to read a file using sudo? [closed]

As part of an lab that I am doing titled "sudo", one of the questions is, "What is the password in the secret.txt file?". When I try cat secret.txt I get a permission denied message. When I try sudo ...
2
votes
0answers
19 views

`listpw` Default option not working with sudo 1.8.24

I'm using sudo 1.8.24 on arch linux (just the default version that comes with the OS), and running into problems where it prompts me for my password just to list that a command is valid. Here is my /...
1
vote
1answer
41 views

How to add file to /etc/sudoers.d/ from non-root user?

I'm trying to write a script for Centos 6.8 where the user will not be root. There is no admin on the premises, so the script needs to be added to the sudoers (by adding a file to /etc/sudoers.d) by ...
0
votes
1answer
75 views

SSH port forwarding: “Privileged ports can only be forwarded by root” error

I wanted to forward my local 8080 port to the 80 port of the server I want to log in via SSH, so I did: ssh -L 80:127.0.0.1:8080 -N -f myserver But I get the error: Privileged ports can only be ...
1
vote
1answer
37 views

Linux - why do the su and sudo binaries need to be set-UID root?

I am trying to find the correct reason for the stated question. My understanding is that: sudo needs to read the /etc/sudoers file which is only readable by root, which is why it needs to be set-UID ...
0
votes
1answer
19 views

How to get Mac OS to remember previous auth. from my executable file

I'm writing a tiny unix executable file that changes my macbook's system time manually. Of course, this requires a password, and so I used the system() function to interface with the terminal and ...
1
vote
3answers
104 views

su - user Vs sudo su - user

sudo su - will elevate any user(sudoer) with root privilege. su - anotheruser will switch to user environment of the target user, with target user privileges What does sudo su - username mean?
0
votes
1answer
30 views

Run bash subshell with commands as other user and not return to parent shell

As part of my quest to preserve bashrc and vimrc when switching to non-root users, I plan on making some super ugly aliases to switch to other users, immediately execute some commands, and then drop ...
0
votes
1answer
34 views

How do I make any newly created file in a specific directory executable, readable and writable by default by all users

The question that I am unable to find answer for is as follows: How do I make any newly created file in a specific directory executable, readable and writable by all users. So I've got an NFS, one ...
0
votes
1answer
23 views

Ubuntu bash echo “$PASSWORD” | sudo -S WID=$(cat /var/lib/FILE)

/var/lib/FILE root:root 0600 (One line of text) How can I read the /var/lib/FILE into $WID echo "$PASSWORD" | sudo -S WID=$(cat /var/lib/FILE) not working for me.
0
votes
1answer
30 views

Why would `read -s` behaves differently than `read` if killed with `ctrl-c`?

Consider this script: #!/bin/bash echo "hi there $(whoami)" [ "`whoami`" = "root" ] || { exec sudo -u root "$0" "$@" echo "this is never called" } read -s -p "enter stuff: " stuff echo "answer:...
1
vote
0answers
30 views

Passing environment variables via sudo on solaris 10

I need to execute a command via sudo on Solaris 10, and I need to pass two environment variables to the command. This must be done in /bin/sh, not bash, not ksh. This is possible on Linux, serveral ...
4
votes
1answer
109 views

“ALL ALL=(ALL) NOPASSWD:ALL” was auto added in my /etc/sudoers file. Is this a Security Breach?

ALL ALL=(ALL) NOPASSWD:ALL line was auto added twice at the end of my /etc/sudoers file. My linux suddenly stopped asking for a password every time I ran a sudo command. This made me investigate the ...
-1
votes
1answer
42 views

run certain program without sudo but with password prompt

I want to be able to run visudo without sudo (because visudo obviously wants to be used as root), but I want it to prompt for my password (for security reason). Is there any way to do this? Something ...
-2
votes
2answers
43 views

LS_COLORS how persist after sudo su

I have a username created on my machine and the username is added to sudoers file to have root access. My .bashrc file also contains a script which is saying to change the colors for the PS1 and the ...
0
votes
1answer
21 views

Why is there a different result when running as user1 and su - user1 -c “command”?

When running as user1 in the same directory (/home/user1/WWW) [user1@server1 WWW (master)]# touch c Creates the file c inside the directory. [root@server1 WWW (master) ACCEPTATIE SERVER]# su - ...
-1
votes
3answers
89 views

Know password, but can't SU or run commands with sudo [closed]

This issue popped up about a week ago, not sure what caused it. Previously the environment had been working as expected. Using a VM hosted on VMWare tools, uname -a returns roughly the following. -...
0
votes
2answers
39 views

How to run a command as apache

I want to edit my server files as a user in the apache group So, I need to chmod all files to 0775 as user apache. But, I am unable to su apache. I don't know the password for it, and entering empty ...
0
votes
0answers
20 views

Want to preserve bashrc and vimrc when switching to non-root users

I'm on a multi-user system. I have sudo b/c I'm responsible I guess. Sometimes, I want to switch to another user to help them do something, but I have a tricked-out bashrc/vimrc and I'd like to keep ...
0
votes
0answers
18 views

tighten security on /etc/sudoers execution grants

I have been adding lines similar to this to a file in /etc/sudoers.d/: %mygroupname ALL=(ALL) NOPASSWD: /sbin/mount, /sbin/umount However, I believe that can be improved upon. For example, I am ...
0
votes
1answer
44 views

Having trouble changing character set in terminal

The GNU/Linux terminal doesn't display Swedish characters (sv_SE.UTF-8). I've googled, and found several sources with various solutions. To summarize the error, no matter what guide I follow, is ...
0
votes
0answers
24 views

Non-interactively change user in bash

I want to create a new user, add it to the sudo group and then change to that user not-interactively (i.e. without entering the password via stdin) in a test scenario on a vm. I tried this, but this ...
3
votes
3answers
33 views

Sudo tickets and subsequent non-sudo sibling process

Imagine that locally on my system sudo is configured with a timeout, so that once I authenticate after running sudo once in some terminal, I don't need to re-authenticate for another 10 minutes. Does ...
1
vote
1answer
40 views

sudo: ./<SomeBinary>: command not found when run from mounted folder [closed]

https://stackoverflow.com/questions/12996397/command-not-found-when-using-sudo is exactly what I am looking for but none of the answers worked for me. I am using Arch Linux. I am trying to run a ...
-1
votes
1answer
21 views

centos - background processes

I have a machine where running tcpdump on wifi interface requires sudo privleges. So if I run a background job like, sudo tcpdump -i wlp8s0 'port 80' & (I know its meaningless to do it as I am ...
0
votes
1answer
37 views

How can *command* work, but *sudo command* not work? [duplicate]

When I type the command pip it works fine (gives me a help page). But when I type the command sudo pip it gives me the response sudo: pip: command not found whereas for example 'sudo python' ...
1
vote
1answer
68 views

Username is not in the sudoers file. This incident will be reported - WHERE/HOW? [duplicate]

When a user not in sudoers tries to elevate privileges to root (in Ubuntu 18.04 for example) the OS displays this alert: "Username is not in the sudoers file. This incident will be reported". Now, ...
1
vote
1answer
53 views

/etc/sudoers: why is there an entry for root?

We are distributing a standard sudoers file to our Linux servers. From an historical point of view the line .. root ALL=(ALL) ALL has been removed or never added. The package default ...
1
vote
0answers
29 views

sudo does not recognize new group

Why won't sudo recognize my group, in a fresh login after using groupadd? Our DigitalOcean CentOS comes with a borked sudo implementation. It's the following script, note well line #2: $ nl $(which ...
1
vote
1answer
47 views

Mistyped command: sudo nano / -name “supervisor”

Instead of using sudo find / -name "supervisor" I ran sudo nano / -name "supervisor" by mistake, which looked like it opened a blank nano file before I hit CRTL-X... $ sudo nano / -name "supervisor" ...
0
votes
1answer
117 views

CentOS 7 - No packages marked for update

With yum update I'm not able to update packages. I have tried every possible solution which is provided like yum clean, yum repolist, etc but none of this seems to solve this problem. sudo yum update ...
0
votes
0answers
74 views

sudo prompt won't let me submit my sudo password

When I ssh into my CentOS 7 machine and try to use sudo, I'm unable to submit my password. Example prompt: $ sudo ls [sudo] password for edwardloveall: Then I type my password, hit Enter, and ...
1
vote
1answer
77 views

execute command with sudo and execute Bash script with sudo

I was always thinking that to execute commands with sudo and to execute bash script with sudo were the same. But today I find that they are different. Here is what I've tested: me@my_machine:~$ sudo ...
0
votes
1answer
36 views

Which is not searching full $PATH

If I run sudo which abc I would expect it to search the superusers $PATH for the program 'abc', but it looks like it only searches a subset. I can see this by running sudo echo $PATH and comparing ...
0
votes
2answers
41 views

Unable to go inside directory on Debian 9

I am logged in as sudo user on Debian 9. When I do ls then it shows me there is a directory called vars If I do cd /vars then I get error bash: cd: /vars: No such file or directory If I do sudo ...
1
vote
2answers
46 views

When does it start to count the time limit set for password caching in `sudo`?

If I run a time-consuming command with sudo , after it finishes running, if I run another command with sudo, it seems that I don't need to type in my password again. It seems the password that I typed ...
2
votes
1answer
63 views

sudo and su commands do not work, after executing sudo chsh -s /bin/zsh

So, I've been trying to install zsh. It didn't work properly, after terminal restart, so I decided to change the shell again by typing chsh -s /bin/zsh, once again, but accidentally preceded that with ...
2
votes
1answer
97 views

Allow regular user to use mount without SUDO or FSTAB

Our desktop workstations are linux. Each user uses Active Directory to authenticate. Mount does not automatically use the users PAM credentials to authenticate against a remote mount point - you must ...
1
vote
1answer
29 views

change the executable JAR file permissions accordingly:

I've created a user using sudo useradd -m peris, then I want to change an executable JAR file permissions, but I got an error: $ sudo chmod 500 menu-prices-update-0.0.1-SNAPSHOT.jar [sudo] password ...
-1
votes
2answers
34 views

Is there a workaround the sudo permission? [closed]

I just got assigned the task to install and compare two software packages for linux but I don't have sudo permissions to do so. Is there a work around it? Is this even possible? Another question ...