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.

Filter by
Sorted by
Tagged with
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 ...
fl00r's user avatar
  • 1,393
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.
TaylorOtwell's user avatar
  • 2,095
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?
Lazloinn's user avatar
  • 401
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 ...
Nur's user avatar
  • 4,081
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 ...
Stéphane's user avatar
  • 2,526
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"&...
Jack's user avatar
  • 3,899
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 ...
BhaveshDiwan's user avatar
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 ...
GoodNite's user avatar
  • 2,731
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!
DrKenobi's user avatar
  • 6,432
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 ...
user avatar
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 ...
BhaveshDiwan's user avatar
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 ...
David B's user avatar
  • 11.1k
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 ...
Kit Sunde's user avatar
  • 11.1k
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] ...
user251948's user avatar
  • 1,521
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 ...
Smile.Hunter's user avatar
  • 8,365
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 \'+ \ ...
Viswa's user avatar
  • 1,669
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?
Pandya's user avatar
  • 35.7k
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 ...
coffee-grinder's user avatar
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?
genz's user avatar
  • 149
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: ...
tutuca's user avatar
  • 2,672
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 ...
ava's user avatar
  • 1,103
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 ...
Khaled's user avatar
  • 1,662
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 ...
Rakesh Godhala's user avatar
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,...
Paul's user avatar
  • 4,511
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 ...
aychedee's user avatar
  • 8,207
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 ...
Registered User's user avatar
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: ...
Luis Alvarado's user avatar
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 ...
pastim's user avatar
  • 900
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 ...
Eliah Kagan's user avatar
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' ...
kemra102's user avatar
  • 2,836
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 ...
sorin's user avatar
  • 9,868
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 ...
Eliah Kagan's user avatar
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 ...
ccrama's user avatar
  • 435
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.
Varun Sridharan's user avatar
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 ...
DEEP BHOWMIK's user avatar
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 ...
FirstName LastName's user avatar
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 ...
Web-E's user avatar
  • 21.4k
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 ...
Manojkumar's user avatar
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 ...
Santosh Kumar's user avatar
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 ...
nicholsonjf's user avatar
  • 2,541
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?
saket's user avatar
  • 1,821
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 ...
gatoatigrado's user avatar
  • 1,803
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.
Joe C's user avatar
  • 1,335
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 ...
Oxwivi's user avatar
  • 17.8k
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 ...
zetah's user avatar
  • 9,653
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 ...
kismat's user avatar
  • 351
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 ...
Scott Severance's user avatar
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 ...
fedorqui's user avatar
  • 10k
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
user20698's user avatar
  • 301
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 ...
Hojat Taheri's user avatar
  • 5,409

1
2 3 4 5
10