Questions tagged [sudo]

The sudo command is a program for some Unix and Unix-Like operating systems, that allows a user to execute programs with the security privileges of another user. Typically those of a superuser or the root user.

Filter by
Sorted by
Tagged with
9 votes
1 answer
5k views

non-interactive ssh sudo... prompts for the password in plain text

I'm running some non-interactive ssh commands. The ssh authentication is taken care of fine through the ssh agent, but if I run a command that requires sudo then the password prompt in my terminal is ...
ian's user avatar
  • 402
9 votes
2 answers
8k views

Understanding homebrew 'no-sudo' philosophy and questioning FAQ

Having fresh install of OS X, I decided to install python package manager in proper way. So I started googling and found homebrew is the best way. Now I got two questions: from homebrew FAQ: ...
Vito Valov's user avatar
9 votes
1 answer
11k views

Add user to SSH group safe?

I want to control who can log in via SSH on my server. Is it safe to add the group 'ssh' to the users who are allowed to login in? I see some distros use system groups in the user's ID and others ...
user72718271's user avatar
9 votes
2 answers
2k views

Why sudo is needed for rebooting in terminal but not from the GUI?

When I turn on my machine and I log in to my account I can do whatever I want and even shutdown my machine or say reboot. But if I open terminal and try to run the command reboot or shutdown then I ...
Aman Deep Gautam's user avatar
9 votes
4 answers
4k views

Different SSH/Login Password From SUDO Password

I'd like to use a different password to elevate my user to sudo status than the password I use to login (either via GUI, shell, or SSH) to my account. Is this possible? EDIT: Since setting the root ...
Richard's user avatar
  • 3,451
8 votes
4 answers
4k views

Terminal: prefix previous command?

Frequently in Terminal (though I fully expect any answer will work in bash and most others), I type some command, and then get some sort of permission error due to missing sudo. Okay, so press 'up', ...
OJFord's user avatar
  • 621
8 votes
3 answers
34k views

What is the difference between adding a user to "sudoers" vs "root" group?

I have done some research and in order to allow the user to use the sudo command, you must add them to the "sudoers" group. This gives them root privileges as long as they enter in root's password. ...
Michael's user avatar
  • 207
8 votes
1 answer
21k views

Bash: permission denied for file write

I followed this tutorial guide on "How to Create Linux Proc Files in C Program using LKM". I've successfully made my module and loaded it in. Now I want to echo to my proc file to make sure the ...
Sam's user avatar
  • 83
8 votes
4 answers
16k views

How can I start a program as root using the window manager?

I sometimes want to start a graphical program explicitly as root. For now I'm starting a terminal and sudo the desired applicaton. But is there a way to start an application as root directly from its ...
Daniel Rikowski's user avatar
8 votes
4 answers
7k views

Lost sudo/su on Amazon EC2 instance

I have an Amazon EC2 instance. I can login just fine, but neither "su" nor "sudo" work now (they worked fine previously): "su" requests a password, but I login using ssh keys, and I don't think ...
user avatar
8 votes
2 answers
19k views

Jenkins Docker image has no make or sudo

I'm trying to set up CI on AWS using the Jenkins image from the Docker hub. I've gotten a few hours into the process (configuring for a Node project), and I've now realized that a few of my npm ...
Jacob's user avatar
  • 83
8 votes
2 answers
78k views

sudo: Sorry, user root is not allowed to execute

This command fails on OpenSuSE 11.4: root@host# sudo -S -u "coreapp_customer1_d" -g "coreapp_customer1_d" /bin/bash -l -c "mkdir -p /home/coreapp_customer1_d/.ssh" with this message: Sorry, user ...
guettli's user avatar
  • 337
8 votes
1 answer
16k views

Add a user to sudoers file, for just one service

I want to add a user to the sudoers file so that it can only start, stop and restart a particular service. I am using Debian and can access the sudoers file using sudo visudo, I am stumped now though ...
Jake N's user avatar
  • 299
8 votes
6 answers
6k views

Allowing automatic command execution as root on Linux using SSH

What is a good setup that allows automatic execution of a command or a script on a remote server with root privileges using SSH? I'm aware (only vaguely for some the options) of the following options: ...
Martin Prikryl's user avatar
8 votes
5 answers
7k views

Should I use sudo in a script or sudo an entire script?

I run a small group of macOS machines for students (say 20) and they all need to be setup with things like homebrew and other packages and applications. I'm writing a bash script to automatically ...
James C.'s user avatar
7 votes
2 answers
13k views

Sudoers NOPASSWD for single executable but allowing others

Operating System: Arch Linux Linux version: 4.16.11 Sudo version: 1.8.23 What I need: be able to execute any executable with a sudo with a password prompt be able to execute one executable, /home/...
Yaroslav Mytkalyk's user avatar
7 votes
4 answers
105k views

How to execute a command with admin privileges and access to files of the logged in user?

I have some problems understanding sudo. I am logged in on a terminal as an non-admin/non-root user. This "normal" user is not in the sudoers file (and shouldnt be, in my opinion). Now I try to ...
robertj's user avatar
  • 383
7 votes
7 answers
3k views

Pre-authorise sudo? (So it can be run later)

I often set my work computer running some time-consuming computations before I go home in the evening. After they're done, I'd like it to shutdown. However, as shutdown requires root privileges, it ...
user250993's user avatar
7 votes
5 answers
10k views

Xforwarding doesn't allow for switching users

I'm ssh'd into a remote computer and xforwarding is working fine... but as soon as I "sudo su -" or "sudo su user2" it no longer Xforwards anything giving me the error: X11 connection rejected ...
Jarvin's user avatar
  • 7,266
7 votes
5 answers
8k views

Changed sudoers file and can't open it anymore; can't open any file using root

I changed settings in sudoers file using sudo visudo and messed it up. Now when I try to do it again or open any file using sudo, I can't open it anymore and I get this error message: >>> ...
user avatar
7 votes
1 answer
8k views

How was I able to remove a root owned file without sudo [duplicate]

I had the following output for ls -lFh: -rw-r--r-- 1 hjpotter92 hjpotter92 926 Aug 2 18:40 static.yaml drwxr-xr-x 5 hjpotter92 hjpotter92 4.0K Sep 12 19:40 templates/ -rw-r--r-- 1 root root ...
hjpotter92's user avatar
7 votes
3 answers
14k views

Feedback when typing password at a sudo prompt

When I type in my password at a sudo command line prompt, I would like to see a "*" for each keystroke. How do I do this?
yanokwa's user avatar
  • 2,262
7 votes
2 answers
3k views

How do you set alias sudo='nocorrect sudo ' correctly?

Until Recently I had alias sudo='sudo ' in my .zshrc file. Today I ran into this error on trying to do sudo mv: ➜ ~ sudo mv nginx.conf.orig nginx.conf.orig2 sudo: nocorrect: command not found Now ...
Mike H-R's user avatar
  • 752
7 votes
2 answers
37k views

Running commands as another user on their machine via ssh?

As part of my normal workflow I ssh into another user's machine, switch user to them, run a command, then exit out to my own machine again: ssh hostname sudo su user runcommand exit exit Is there a ...
Esker's user avatar
  • 73
7 votes
2 answers
10k views

Unable to resolve Host - Windows Bash

I'm using Windows Bash and I'm getting the error fox@FOX:/etc$ sudo true sudo: unable to resolve host FOX I've seen people say I'm suppose to edit etc/hosts, but I don't know what to put in the file. ...
ErraticFox's user avatar
7 votes
1 answer
2k views

Two password (factor) authentication to root user / sudo

With regards to running Linux remotely (SSH) I'd like to employ two levels of authentication for accessing the system with root privileges. I have the root account disabled / locked out so direct ...
Mike's user avatar
  • 1,477
7 votes
1 answer
22k views

"echo "password" | sudo -S <command>" asks for password

I trying run a script without become the su user and I use this command for this: echo "password" | sudo -S <command> If I use this command for "scp", "mv", "whoami" commands, the command ...
Jo Shepherd's user avatar
7 votes
2 answers
9k views

'user is not in the sudoers file' but actually is

I have already read a lot of posts about enabling sudo-access for a specific user but those couldn't help me so far. The situation is: I'm running Debian Testing. On the system there are only two ...
Benjamin Kalloch's user avatar
6 votes
4 answers
40k views

Alternative for sudo

I am aware that we can execute a command/script as a super/another user using sudo command. But Is there a possibility where the sudo utility itself is unavailable/removed by the user. If so, what ...
AlwaysALearner's user avatar
6 votes
4 answers
4k views

Why is my sudo generated file owned by root?

When I run '# sudo touch newfile' my expectation was that the file would be owned by me, not by root, as my understanding of sudo is that it is giving me, the user, root priviledges but does not ...
Yarin's user avatar
  • 406
6 votes
4 answers
13k views

Why sudo python and python in terminal start two different versions python?

I had python 2.6 in my server to begin with. Then I downloaded python 2.7 and installed using make and make altinstall. When I try just python in the terminal it opens up python 2.7 but sudo python ...
user avatar
6 votes
5 answers
67k views

Automating the "sudo su - user" command

I want to automate sudo su - user from a script. It should then ask for a password.
sam's user avatar
  • 91
6 votes
3 answers
22k views

Run ifconfig without sudo

I have an embedded Linux running on a imx6 platform. This is a freescale embedded linux. The problem is that there is no sudo available for this linux, but I need to activate and deactivate the wlan0 ...
Irgendw Pointer's user avatar
6 votes
3 answers
4k views

Sudo with auth sufficient pam_tid.so does not work with tmux

I did not really like the idea of installing some third-party sudo tool, so instead of using sudo-touchid I decided to use the /etc/pam.d/sudo trick and it works wonders. I use iTerm2 with zsh, and ...
RomaValcer's user avatar
6 votes
5 answers
11k views

Make Regular User automatically Root on Ubuntu (i.e., make Ubuntu behave like Windows XP)

I'm getting annoyed by having to use sudo on my Ubuntu machine. The following are some of the reasons why: I open some file owned by root, but I forget to open it with sudo. Now, I make a bunch of ...
red.october's user avatar
6 votes
1 answer
35k views

sudo su "username" vs. su "username"

Please explain me, what is the difference between: sudo su "username" vs. su "username" Which has higher privileges? If I log into root with sudo su "username", I am root for one command only? So it ...
Peter's user avatar
  • 73
6 votes
1 answer
4k views

Secured bash history usage

I know all commands user sends to server are automatically logged into ~/.bash_history I want to give access to my PC to my colleague (I've already gave hime some limited access to use sudo via /etc/...
Radek Simko's user avatar
6 votes
3 answers
40k views

"Unable to locate package sudo" when i try to install sudo on new Debian

i installed a new Debian on a small VPS and now when i try to install sudo i just get this message. I also tried to add FTP-Server into the list and i still get that error. root@srv45758:~# vi /etc/...
Janlasse's user avatar
6 votes
2 answers
5k views

Set default editor for crontab -e invoked with sudo

I'm using Bash on Debian Squeeze. I just read this topic: change default text editor for crontab to vim I have exported both variables VISUAL and EDITOR to vim for normal user and for root. And this ...
Coolmax's user avatar
  • 61
6 votes
2 answers
8k views

Why sudo curl ignores proxy settings?

$ echo $http_proxy http://my.proxy.com $ curl -v http://files.com/a.txt * About to connect() to proxy my.proxy.com # Correct downloading $ sudo echo $http_proxy http://my.proxy.com $sudo curl -v ...
Nelson Tatius's user avatar
6 votes
1 answer
4k views

Why strace sudo command bombs when sudo command works?

my username is allowed to execute sudo command then why does this bomb strace sudo command with the error: sudo: must be setuid root
user322908's user avatar
6 votes
1 answer
16k views

Permission denied on Chromebook even with sudo

When I compile my C++ code on my Chromebook's shell, I get the error bash: ./a.out: Permission denied. This happens even when I run with sudo: sudo: unable to execute ./a.out: Permission denied. Why ...
Michael Kolber's user avatar
6 votes
1 answer
2k views

Why does redirection fail when passing through ssh, sudo and sh?

After reading this question, I know that I have to do sudo sh -c 'ls -hal /root/ > /root/test.out' to avoid the "Permission denied" error. But when I do ssh hostname sudo sh -c 'ls -hal /root/ &...
Fabien's user avatar
  • 163
6 votes
1 answer
3k views

sudo -E not passing all variables

Reading the man pages I expected sudo -E to pass all environment variables to the subshell, but I am not getting the expected results. As expected, awesome: $ export LD_LIBRARY_PATH=/home/mmendez/...
mmlb's user avatar
  • 163
6 votes
4 answers
7k views

sudo to kill output of ps, awk, xargs

I want to kill root owned processes containing foo in the process name sudo sh -c "ps aux | grep [f]oo | awk '{print $2}' | xargs kill -15" this command fail as awk and xargs are ignored. sudo sh -...
Dave's user avatar
  • 429
6 votes
1 answer
8k views

sudo does not preserve PYTHONPATH

I modified /etc/sudoers (using visudo) to keep environment variables : Defaults !env_reset # Host alias specification # User alias specification # Cmnd alias specification # User privilege ...
Eric's user avatar
  • 161
6 votes
1 answer
19k views

usermod returns "group 'thegroupname' does not exist" for known group

As a member of sudo can I add myself to a group I don't belong to? $ getent group thegroupname thegroupname:x:123794798:administrator,users,auser,moreusers,manymoreusers $ sudo usermod -a -G ...
Louis Waweru's user avatar
  • 24.6k
5 votes
3 answers
7k views

Why can you not sudo history?

If I want to view root's bash history, why can I not just run sudo history? when I do it says command history not found, but if I run it without the sudo it runs fine. Edit: it's a duplicate answer, ...
StackOverflowed's user avatar
5 votes
3 answers
92k views

How to recover the password for a particular user account on my linux pc

I have a linux pc on which several users are configured to login. for the same PC i have the root access (username and password). I have lost one of the user accounts password. How to get back the ...
user avatar
5 votes
2 answers
6k views

How can I alias a command for sudo?

I have an alias that I would like to use both as a regular user and as root, via sudo. Specifically, it is this: alias rm=trash This works fine as a normal user, and it works fine when I use sudo -i ...
Ryan C. Thompson's user avatar

1 2
3
4 5
23