Skip to main content

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
979 votes
7 answers
3.4m 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
967 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
539 votes
13 answers
1.1m 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
  • 11.1k
379 votes
10 answers
1.0m views

Run a shell script as another user that has no password

I would like to run a script from the main ubuntu shell as a different user that has no password. I have full sudo privileges, so I tried this: sudo su -c "Your command right here" -s /bin/sh ...
rubo77's user avatar
  • 32.8k
320 votes
2 answers
472k 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,551
316 votes
18 answers
564k 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
287 votes
7 answers
623k 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,227
287 votes
3 answers
403k 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
  • 11.1k
279 votes
5 answers
808k 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,791
271 votes
6 answers
53k views

Where are sudo's insults stored?

For those who like humour, sudo can be configured to print a random more or less insulting or funny phrase instead of the neutral Sorry, try again. by adding the line below to /etc/sudoers (using the ...
Byte Commander's user avatar
  • 108k
269 votes
11 answers
2.0m views

How do I start/stop mysql server?

I tried to find in some articles describing how to correctly start & stop mysql server. I found this link: How to start/stop MySql server on Ubuntu 8.04 | Abhi's Blogging World I ran this ...
user471011's user avatar
  • 3,559
246 votes
8 answers
773k 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
239 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,581
235 votes
8 answers
113k 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,866
231 votes
5 answers
338k 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,469
202 votes
7 answers
305k 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,929
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
188 votes
6 answers
376k 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,395
173 votes
4 answers
884k 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,841
153 votes
7 answers
641k 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,531
149 votes
9 answers
496k views

How could I list all super users?

I want a command to list all users who have root privileges i.e. sudo ? Suppose I'm a sudoer user. How could I know all other sudoer users?
Maythux's user avatar
  • 84.9k
143 votes
10 answers
43k views

Run same command again but as root

Sometimes when I run a command I don't notice that I needed to run it as super user to have enough permission. Is there a way to run the same command again but as a super user?
Trufa's user avatar
  • 4,298
134 votes
4 answers
733k views

I want to copy a directory from one place to another via the command line

I want to copy a directory from one place to another folder. sudo cp is the command, but after that what should I type? The destination or source first?
pradeep's user avatar
  • 1,341
132 votes
1 answer
148k views

Cannot echo "hello" > x.txt even with sudo? [duplicate]

Possible Duplicate: sudo & redirect output I'm trying to create a file in /var/www, but even with sudo this fails: user@debVirtual:/var/www$ sudo echo "hello" > f.txt -bash: f.txt: ...
Patryk's user avatar
  • 9,206
131 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,101
130 votes
12 answers
619k 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
  • 36.1k
127 votes
6 answers
167k 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,863
126 votes
4 answers
82k views

Remove note about sudo that appears when opening the terminal

Whenever I open the terminal, To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. appears before the terminal. How do I get that to go ...
mouche's user avatar
  • 1,497
125 votes
6 answers
278k 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
118 votes
4 answers
278k 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,345
117 votes
4 answers
1.7m views

how to use sudo command to install .tar.gz? [duplicate]

Possible Duplicate: How to install a .tar.gz (or .tar.bz2) file? I am newbie to ubuntu. I would like someone to explain how to use sudo command to unzip & install .tar.gz file to me.
omjaijagdish's user avatar
  • 1,179
112 votes
9 answers
213k views

How do I fix a "E: The method driver /usr/lib/apt/methods/http could not be found." error?

I tried updating my packages from the terminal and this is what I got: $ sudo apt-get update E: The method driver /usr/lib/apt/methods/http could not be found. E: The method driver /usr/lib/apt/...
Abe's user avatar
  • 1,129
112 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,123
110 votes
7 answers
61k 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,452
105 votes
8 answers
177k views

How to enter a directory with the 'cd' command if it has 700 permission and is not owned by me?

I tried to use sudo cd name_of_dir but am getting the error message: sudo: cd: command not found Is there any other way to enter a directory owned by another user which has 700 permission?
Bakhtiyor's user avatar
  • 12.4k
100 votes
6 answers
352k views

How to avoid being prompted for a password by sudo? [duplicate]

I know I can become root (super user) via the su command but I have to authorize it after entering the commands. Is there a way I can become root and authorize (with password) in one line
Vader's user avatar
  • 1,402
100 votes
11 answers
276k 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,928
98 votes
4 answers
405k 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
  • 18k
93 votes
3 answers
69k views

Is it possible to stop .sudo_as_admin_successful being created?

Every time I execute a command with sudo, a file called .sudo_as_admin_successful is created in my home directory. As far as I can tell, this exists for the sole purpose of disabling this message that ...
ash's user avatar
  • 2,117
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
91 votes
8 answers
287k views

sudo: source: command not found

I've been updating some of the default profile for bash, and saw from the tutorials I was following that I could reload the new profile with the new environment settings by using: source /etc/bash....
HorusKol's user avatar
  • 1,537
90 votes
4 answers
65k views

Terminal command with sudo takes a long time

I noticed that the terminal recently becomes too slow when I execute a command that needs my password. It takes some seconds to display [sudo] password for ... I'm using Dell XPS developer edition (i7,...
Nasreddine's user avatar
  • 1,537
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
84 votes
2 answers
66k views

Who are incidents really reported to, and how can a sudo user access the reports?

When my non-sudo account tries to run a sudo command: nonsudo@Hairy14:$ sudo hello An incident is reported: [sudo] password for nonsudo: nonsudo is not in the sudoers file. This incident will be ...
Tim's user avatar
  • 33k
83 votes
3 answers
73k views

What is the difference between the 'sudo' and 'admin' group?

I noticed that two groups are granted similar-looking permissions in /etc/sudoers: # Members of the admin group may gain root privileges %admin ALL=(ALL) ALL # Allow members of group sudo to execute ...
ændrük's user avatar
  • 77.2k
80 votes
6 answers
18k views

When using && and sudo on the first command, is the second command run as sudo too?

If I run a command. sudo some-command && some-other-command Is the second command being run with sudo previlege also?
user974407's user avatar
  • 2,166
80 votes
5 answers
94k views

How to use a python virtualenv with sudo?

I am trying to make a python environment separate from the system one (using virtualenv) in a directory which is not under /home, because I need to use it to build other software that has to be ...
Marco P.'s user avatar
  • 828
74 votes
2 answers
89k views

after upgrade gdb won't attach to process

I just recently upgraded from 10.04 to 11.04 and gdb won't allow me to attach to processes anymore I get the error Attaching to process 10144 Could not attach to process. If your uid matches ...
Andrew Redd's user avatar
  • 2,157
71 votes
12 answers
62k 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,383
71 votes
2 answers
414k views

How to come out of root user?

I just gained root access following steps from the http://www.wikihow.com/Become-Root-in-Ubuntu. My prompt get changed from $ to # sign, indicating I have root access. Now I have come out or log out ...
Sohel Ahmed Mesaniya's user avatar

1
2 3 4 5
59