Questions tagged [sudo]
The sudo command allows users to run programs with the privileges of a different user (normally the root user). Use this tag for questions related to configuring and using the sudo command.
486
questions
72
votes
12
answers
61k
views
What if I accidentally run command "chmod -R" on system directories (/, /etc, ...)
I accidently ran
sudo chmod 755 -R /
instead of
sudo chmod 755 -R ./
I stopped it after a few seconds, but now I'm starting to have problems. For example, sudo isn't working anymore:
sudo: must be ...
196
votes
8
answers
124k
views
How to avoid using sudo when working in /var/www?
I want to stop having to use sudo everytime I work in /var/www. How can I do that? I simply want to put all of my sites into this directory and work with them without too much pain.
40
votes
8
answers
66k
views
Nothing shows up in the terminal when I type my password
When I'm about to install a program in the terminal it wants the password:
[sudo] password for xxx:
But when I start to type my password nothing happens. What should I do?
130
votes
3
answers
36k
views
Why should users never use normal sudo to start graphical applications?
I've read the comunity "RootSudo" documentation and am interested in this line:
You should never use normal sudo to start graphical applications as Root.
Why? What is the difference? Please ...
69
votes
5
answers
80k
views
How do I add myself back as a sudo user?
I clean-installed Ubuntu 11.10 today, and then installed VirtualBox. This required me to add myself to the vboxusers group, and since 11.10 seems to no longer have a graphical app to add users to a ...
201
votes
7
answers
297k
views
How to solve "permission denied" when using sudo with redirection in Bash?
When using sudo to allow edits to files, I regularly get 'permission denied'.
For example, my mouse is jittery and sluggish, so I want to disable polling:
sudo echo "options drm_kms_helper poll=N"&...
285
votes
3
answers
394k
views
How do I run specific sudo commands without a password?
On one particular machine I often need to run sudo commands every now and then.
I am fine with entering password on sudo in most of the cases.
However there are three sudo commands I want to run ...
273
votes
5
answers
727k
views
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
I'm trying to run this command in the terminal:
sudo apt install software-properties-common
This is the error message I get:
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource ...
110
votes
7
answers
60k
views
What is the difference between "gksudo nautilus" and "sudo nautilus"?
I've been using gksudo nautilus and sudo nautilus through Alt+F2.
What's the difference? They look very similar!
314
votes
18
answers
559k
views
How to modify an invalid '/etc/sudoers' file?
How do I edit an invalid sudoers file? It throws the below error and it's not allowing me to edit again to fix it.
Here is what happens:
$ sudo visudo
>>> /etc/sudoers: syntax error near ...
528
votes
13
answers
1.0m
views
Execute sudo without Password?
Inspired by this question....
I am the sole person using my system with 12.04.
Every time I issue a sudo command; the system asks for the user password (which is good in its own way).
However I was ...
970
votes
7
answers
3.3m
views
How can I add a user as a new sudoer using the command line?
After I add a user using adduser, I can't see it via System > Administration > Users and Groups unless I log out and then log in again. Is that normal?
Also, can I set a newly added user as a sudoer ...
962
votes
20
answers
1.4m
views
Error message "sudo: unable to resolve host (none)"
When I run sudo the terminal is stuck for a few seconds and then outputs an error message. My terminal looks like this:
ubuntu@(none):~$ sudo true
sudo: unable to resolve host (none)
What can I do ...
152
votes
7
answers
630k
views
How do I run a 'sudo' command inside a script?
To do a patch manually I must type this command
sudo ./playback_delete_data_patch.sh 09_delete_old_data_p.sql
There is a space just before the 09:
sudo ./playback_delete_data_patch.sh [space] ...
189
votes
6
answers
371k
views
What are the differences between "su", "sudo -s", "sudo -i", "sudo su"?
I already read it from manual but I can't see difference..
su - change user ID or become superuser
sudo -s [command]
The -s (shell) option runs the shell specified by the SHELL environment variable ...
125
votes
6
answers
276k
views
How do I sudo a command in a script without being asked for a password?
I want to turn my system on automatically every day. So I use the below code in my Python script, but sudo asks me for a password every time:
os.system('sudo sh -c "echo date \'+%s\' -d \'+ \
...
131
votes
12
answers
604k
views
/usr/bin/sudo must be owned by uid 0 and have the setuid bit set
I have run following command accidentally
sudo chown [username] -hR /
Now sudo su getting error:
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
How to Solve This?
241
votes
8
answers
751k
views
How do I add a user to the "sudo" group?
In /etc/sudoers I see this:
# Allow members of group sudo to execute any command after they have
# provided their password
# (Note that later entries override this, so you might need to move
# it ...
14
votes
5
answers
441k
views
How can I determine the sudo password?
What is the default password of the sudo? I visit some forums, it tells that the default password is password, but it doesn't work, how can I determine the password?
45
votes
6
answers
128k
views
How to run an application using sudo without a password?
... but still be required for applications that need admin privilegies?
In order to allow the following:
$ apache2ctl restart
httpd not running, trying to start
(13)Permission denied: make_sock: ...
110
votes
4
answers
1.7m
views
How do I login as root?
I want to login as root, but when I enter
sudo -s
and enter password, this message is shown: "you are not in sudoers file", and when I enter
su
and enter password, this is shown: "authentication ...
37
votes
3
answers
24k
views
Redirect the output using `sudo` [duplicate]
I have a small question regarding using sudo with output redirect >. To enable IP forwrding, someone can use the command:
echo 1 > /proc/sys/net/ipv4/ip_forward
Executing this command will ...
22
votes
5
answers
190k
views
'Some index files failed to download' while updating
When running sudo apt-get update I get these following errors:
Err archive.ubuntu.com quantal InRelease
Err archive.ubuntu.com quantal-updates InRelease
Err archive.ubuntu.com quantal-backports ...
320
votes
2
answers
471k
views
'sudo su -' vs 'sudo -i' vs 'sudo /bin/bash' - when does it matter which is used, or does it matter at all?
When I'm doing something that requires root be typed in dozens of times in a row, I prefer to switch my session to a root session. In the various tutorials and instructions I have used on the Internet,...
287
votes
7
answers
620k
views
How to run sudo command with no password?
How does the ubuntu user on the AWS images for Ubuntu Server 12.04 have passwordless sudo for all commands when there is no configuration for it in /etc/sudoers?
I'm using Ubuntu server 12.04 on ...
64
votes
7
answers
20k
views
Can sudo be reinstalled after being removed?
This seems to be a chicken-egg problem.
The most common task using sudo is installing and removing software.
sudo apt-get purge <appname>
But sudo itself can be removed.
sudo apt-get purge ...
38
votes
3
answers
47k
views
How to configure pkexec?
Reading these questions and answers:
When to use pkexec vs. gksu/gksudo?
Why is gksu no longer installed by default?
brought me another one that will create problems for new users of that command:
...
42
votes
8
answers
53k
views
I need an equivalent of gksu in 18.04
I've read a lot of threads about gksu being removed from many Linux flavours, including Ubuntu 18.04. Many state that gksu is an abomination and no user should ever need to use anything like it. I ...
86
votes
3
answers
37k
views
When to use pkexec vs. gksu/gksudo?
There are two general ways to run applications graphically as root (or, more generally, as another user). Programs like gksu, gksudo, and kdesudo are graphical frontends for sudo. In contrast, pkexec ...
232
votes
8
answers
111k
views
Aliases not available when using sudo
I was playing around with aliases today and I noticed that aliases don't seem to be available whilst using sudo:
danny@kaon:~$ alias
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
...
98
votes
11
answers
274k
views
How to launch application as root from Unity Launcher?
Mainly I am looking for a way to pin an application to the Unity launch bar, and run it as root.
Currently, even if I start the application with sudo, and pin it after it starts, it will start as ...
92
votes
1
answer
9k
views
How does sudo handle $HOME differently since 19.10?
In Ubuntu releases prior to Ubuntu 19.10 Eoan Ermine, when I run a command with sudo, that command receives my home directory in the $HOME environment variable. This is the behavior I have long ...
15
votes
3
answers
11k
views
Changed permissions of / to user [duplicate]
I stupidly ran sudo chown -R carlos:carlos / and carlos is my user. This changed all files to be Carlos and I could not boot up again (because the root files were now owned by #1000) and I cant get ...
10
votes
2
answers
2k
views
Use one password for administration and another for system login
How can I give a user one password for normal usage when logging in, and another password for system administration and sudo access? I want one user to have two passwords.
9
votes
1
answer
17k
views
sudo apt-get... returns "Conflicting values set for option Signed-By regarding source" error
Yesterday I installed signal-desktop on Ubuntu 20.04 and after a lot of problems, I finally was able to install it. The details of the problems are given in the post here.
The reason I'm linking my ...
44
votes
5
answers
49k
views
How to NOT become a root user? Are administrators root?
I installed Ubuntu on my PC. To log in, I use the username and password I created during installation. Does this mean I am a root user? If yes, then how do I become non-root? It looks like non-root ...
23
votes
7
answers
29k
views
What are the benefits of sudo over su?
What is the actual benefit that Ubuntu (or Debian derivatives) achieve by disabling root user?
Everywhere I read, it says to prevent unintentional damages for inexperienced users.
I want to know what ...
18
votes
6
answers
84k
views
How to fix sudo after "chmod -R 777 /usr/bin"?
I entered chmod -R 777 /usr/bin and now sudo is not working.
It says sudo must be setuid root.
Some advice online said to run chown root:root /usr/bin/sudo
chmod 4755 /usr/bin/sudo.
On entering ...
59
votes
6
answers
144k
views
Shutdown from terminal without entering password?
I have desktop edition of Ubuntu.
I like the Terminal so that that I prefer to shutdown my computer with the shutdown command.
However when I type shutdown now it prompts me to enter my password.Is ...
235
votes
7
answers
1.2m
views
Sudoers file, enable NOPASSWD for user, all commands
Preface
This is a fairly complex question related to the sudoers file and the sudo command in general.
NOTE: I have made these changes on a dedicated machine running Ubuntu Desktop 13.04, that I use ...
171
votes
4
answers
866k
views
How do I grant sudo privileges to an existing user? [duplicate]
I want to grant a newly created user sudo privileges in Ubuntu.
I tried
sudo adduser hduser admin
but it says no admin group exists.
How can I do it?
123
votes
6
answers
163k
views
Why is sudoers NOPASSWD option not working?
I have a NOPASSWD line in /etc/sudoers (edited with visudo)
gatoatigrado ALL=(ALL) NOPASSWD: /bin/set-slow-cpufreq
However, the output is,
gatoatigrado@coral:~> sudo -n /bin/set-slow-cpufreq
...
117
votes
4
answers
269k
views
Remove sudo privileges from a user (without deleting the user)
If you give a user sudo privileges how can I remove the sudo privileges and make the user become just a regular user?
I used:
sudo adduser username sudo
Now I've changed my mind.
97
votes
4
answers
398k
views
How can I create an administrator user from the command line?
I want to create a user with administrative privileges and all the regular setups like home directory.
Is there a adduser parameter to give the user sudo powers automatically?
What are the default ...
64
votes
5
answers
143k
views
Environment variables when run with 'sudo'
As example to my question, my ~/.bashrc file contains this lines:
export LD_LIBRARY_PATH=/opt/intel/mkl/lib/ia32:$LD_LIBRARY_PATH
export LD_PRELOAD=/opt/intel/mkl/lib/ia32/libmkl_core.so
so that ...
35
votes
3
answers
199k
views
How to solve "sudo: /etc/sudoers.d is world writable"
How can I fix the following error with sudo?
/etc$ sudo
sudo: /etc/sudoers.d is world writable
usage: sudo [-D level] -h | -K | -k | -V
usage: sudo -v [-AknS] [-D level] [-g groupname|#gid] [-p ...
36
votes
2
answers
40k
views
How do I prevent PolicyKit from asking for a password?
For years, I've had the following in my sudoers file:
scott ALL=NOPASSWD: ALL
For those who don't know, this prevents sudo and friends (gksudo, etc.) from asking for a password. However, over the ...
32
votes
3
answers
9k
views
How often is the password asked for sudo commands? Where can I set it up?
I execute quite a lot of sudo commands.
I noticed that if I execute one and then another one within few minutes, the 2nd time I don't get the message:
[sudo] password for my_username:
but I do ...
26
votes
6
answers
60k
views
sudo error, is mode 0777, should be 0440
I am getting sudo errors, how do I fix this error?
sudo: /etc/sudoers is mode 0777, should be 0440
sudo: no valid sudoers sources found, quitting
230
votes
5
answers
334k
views
Why doesn't `sudo cd /var/named` work? [duplicate]
I want to cd into /var/named but it gives me a permission denied error, and when I want to use sudo to do this I am not permitted. What is the technical reason for this, and is it possible to do this ...