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
23
votes
4
answers
38k
views
How to enter password only once in a bash script needing sudo
Data
I want operator users on this machine to mount their own cifs shares
The sudoers file already contains the /bin/mount -t cifs //*/* /media/* -o username=* command for all operators
I want the ...
23
votes
4
answers
146k
views
"Set document metadata failed" when I run sudo gedit
I have upgraded 14.04 to 16.04 . Now I am trying to open the gedit from terminal by passing the command:
sudo gedit /some/where/file.txt
but it is throwing an error stating that:
(gedit:2090): ...
21
votes
3
answers
51k
views
Run apt-get without sudo
This might be a very naive question, but I wanted to know how I could give multiple users access to a single computer without making them root users. How would I give them limitted sudo access such ...
20
votes
2
answers
58k
views
How to allow execution without prompting for password using sudo?
I am writing a Java application where i need to do a command line execution and get a result back, but when i execute the command, it ask for sudo password. So far i tried:
$ sudo -s
$ vim /etc/...
16
votes
3
answers
26k
views
Best practices on using sudo in a bash script
I have a long and long-running bash script where a handful of commands need to be run as root while the majority of commands need to be run as the regular user before sudo, because it would mess up ...
16
votes
1
answer
27k
views
Cannot lock '/etc/group' in recovery mode
I've currently booted into recovery mode, because I removed my sole user from admin :/
When I run adduser oadams admin, I get gpasswd: cannot lock /etc/group; try again later.
For what it's worth, ...
15
votes
2
answers
4k
views
Run only parts of a script as sudo, entering password only once
I am writing a script (actually a combination of scripts and makefile) that installs external dependencies: some apt-get commands, some git cloning, building, installing, adding users to groups, ...
...
14
votes
1
answer
13k
views
How to configure pkexec to not ask for password?
I have a GUI application that needs to call a daemon (written in Python) with superuser privileges. I would like to do this without prompting the user for a password.
Since the daemon is a script, I ...
10
votes
4
answers
79k
views
How to execute sudo commands with Expect & send commands in bash script?
Can anybody let me know how to execute sudo commands with expect? I tried the following but this is not working. Can anyone give me suggestion please?
set login "sasuke"
set addr "hostname"
set pw "...
8
votes
2
answers
13k
views
Password not working in Graphical Applications (gksu)? Works with sudo
I am having a problem where when I try to run say GParted, when I am prompted for a password, it says "Incorrect Password"
But when I enter the same password using terminal sudo gparted for example, ...
7
votes
2
answers
41k
views
How do I deal with 'sudoers.so must be only be writable by owner'?
Whenever I try to install or remove something using terminal it gives the following error message:
bluebird@bluebird:~$ sudo apt-get update
sudo: /usr/lib/sudo/sudoers.so must be only be writable by ...
7
votes
1
answer
6k
views
Unable to open any graphical app with "sudo"
Tried to find some answer here: Can't launch graphical apps from terminal after updating to 15.10, but it didn't solve my problem.
$ sudo gedit
Failed to connect to Mir: Failed to connect to ...
6
votes
1
answer
14k
views
Cannot change Intel turbo boost (/sys/devices/system/cpu/intel_pstate/no_turbo/ not accessible)
Trying to follow this answer under Disabling Intel Turbo Boost in ubuntu:
In order to see the driver:
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_driver
intel_pstate
intel_pstate
intel_pstate
...
4
votes
2
answers
3k
views
What is the difference between sudo X and running X as root?
My question is asking regarding a specific observation that I would like to understand.
I just tried to install the package rJava in R and failed even though I prefaced the installation as suggested ...
3
votes
4
answers
25k
views
How to run a file with sudo without a password? [duplicate]
Possible Duplicate:
How to run an application using sudo without a password?
I've made a script that preforms various system tasks, that I run regularly, but I have to use sudo to run the script, ...
3
votes
2
answers
10k
views
How can I re-instate my admin privileges?
I am running 12.04 LTS. It's a pretty default installation and is the only OS on this machine.
I have two users one has administrator rights the other does not.
I accidentally removed administrator ...
2
votes
1
answer
806
views
block certain dangerous commands?
In my High school there are few computer having Ubuntu 14.04 installed and many students know the Root password,
how can I block/disable certain dangerous commands like :- rm -rf / rm -rf * :(){:|...
2
votes
3
answers
29k
views
Cannot authenticate without a password
The problem can be reproduced as follows:
When I remove the password of an administrator account, "Log In without Password", I cannot use that account to authenticate.
When I do something that ...
2
votes
5
answers
6k
views
What's exactly the point of the sudo command, in terms of security?
This question is actually non Ubuntu-specific. My understanding is that sudo is to prevent non-authorized users from doing administrative and other potentially harmful operations. The premise is that ...
0
votes
2
answers
3k
views
What is the root user?
If you use sudo su - or sudo -s you will have full root privileges.
Is this root user an official user or is it from Canonical?
~$ sudo su -
[sudo] password for username:
root@lp:~# id
uid=0(root) ...
129
votes
1
answer
145k
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: ...
74
votes
2
answers
88k
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 ...
55
votes
4
answers
22k
views
How to cancel the currently-applied remaining sudo time-out?
When I've just run sudo, and don't want it to remain active for the normal duration of its time-out, how can I cancel that remaining active time-out?
sudo -k kills it for the current terminal ...
37
votes
4
answers
301k
views
Cannot connect to X Server when running app with sudo
When I am running some software using sudo command it showing error like
cannot connect to X server
For example if I run the following command:
$ sudo gedit /etc/profile
I am getting following ...
33
votes
6
answers
9k
views
Are user files still private when two sudo users exist in Ubuntu?
I am sharing my personal Ubuntu PC with one of my colleagues.
I created another user with a different password (he knows of course) and added it to the sudoer list.
Given that there are two sudo ...
21
votes
3
answers
61k
views
Save an edited file in nano, but no permissions
I edited a file in /etc/ that I want to save, but forgot to open it using sudo. I remember there was a command to save such a file in vi, and want to know if there is any such way to do it in nano?
...
18
votes
3
answers
65k
views
Disable sudo permission to user from command line
I have activated root user in ubuntu and want to use ubuntu as server with no DE. For this I want to disable sudo privilege given to first user. How can I do this from command line ? I know I can use ...
16
votes
2
answers
23k
views
Let normal user restart service with /etc/sudoers
I have a service (kado-demo.service) that a normal user (kado) should be able to restart without entering any password.
I created /etc/sudoers.d/user_restart and added
kado ALL=NOPASSWD: /bin/...
16
votes
2
answers
75k
views
Open file or application as root from GUI
Is it possible to open a file or application as root from the GUI?
My ideal would be right-clicking on a file or an application and seeing an "Open as Root" choice in the context menu, after which I ...
13
votes
3
answers
76k
views
How to change permission of a drive in an external hard disk?
I had an old laptop. When it got complaint I removed its hard drive and started using it as external hard disk. It has an 80 GB of memory allocation for the windows C drive partition. But now i don't ...
10
votes
2
answers
2k
views
Can there ever be any problem when using gedit to edit system files with 'sudo -H gedit'?
I am relatively new to Ubuntu, I noticed that in answers on this site, when people suggest editing system files, the command they give is always sudo nano or sudo vi.
Because I dislike using terminal ...
10
votes
4
answers
60k
views
Error after sudo-ing "sudo: must be setuid root"
On a colleagues computer, everytime I use a sudo command, I get this error:
sudo: must be setuid root
I tried various things mentioned on the internet, like changing the permissions to 4755 from a ...
9
votes
1
answer
4k
views
Why should I use gksudo for Gtk apps instead of sudo? [duplicate]
I read somewhere that people should use gksudo for applications that use the Gtk GUI instead of sudo? What's the reasoning for this?
7
votes
2
answers
5k
views
E:can not open /var/lib/apt/lists/*** ... E:The package lists or status file could not be parsed or opened
I ran sudo apt update and and so on in the terminal, and then I got this error. I can't copy and paste this error code, so I wonder what could be the problem. Is it some permissions issue or something ...
4
votes
4
answers
17k
views
Undo sudo rm -R /*
I stupidly ran sudo rm /* followed by sudo rm -R /*
My sites still run, although the vast majority of commands like ls are now broken.
Is there a simple way to get data off the server or reverse ...
4
votes
1
answer
4k
views
Is it a good thing to run virt-manager as sudo?
I just installed qemu-kvm and virt-manager. But when i run virt-manager by clicking the icon it is not connecting to kvm. But when i run $ sudo virt-manager KVM connects.
i've been told that running ...
3
votes
4
answers
14k
views
How can user mount an encrypted file container in VeraCrypt?
I have a number of external media with VeraCrypt encrypted file containers and I would like the users to mount and use them without giving root privileges to the users.
However at the moment ...
3
votes
1
answer
4k
views
Executable runs without sudo but not with sudo
I installed xampp in my system in the location /opt/lampp. After that I added the php location to my path variable using
export PATH=$PATH:/opt/lampp/bin
So when I run php -v using terminal I get ...
2
votes
2
answers
3k
views
terminator: permission denied for sudo
I updated to Ubuntu 20.04. When I use the default terminal, everything is fine. But if try to use terminator, I cannot use sudo. I get permission denied. Again, only when using terminator.
How can I ...
2
votes
3
answers
16k
views
sudo: /var/lib/sudo/navneet writable by non-owner (040777), should be mode 0700
This error occurs whenever I try to work with sudo. I changed the permissions of /var/ folder to 777 and I think this causes the error. Please help me get back a functional sudo and /var.
269
votes
11
answers
1.9m
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 ...
79
votes
4
answers
90k
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 ...
59
votes
4
answers
175k
views
How to give nopasswd access to multiple commands via sudoers?
Below is what I know:
I have to add this below line in sudoers file to give rights to the user for particular task.
user_name ALL=NOPASSWD: /usr/bin/apt-get install
In this case I want to give ...
54
votes
3
answers
97k
views
How do I sudo without having to enter my password? [duplicate]
I'm trying to setup sudo without no password but still I get prompted for password, I'm using ubuntu, here is the relevant line from the sudoers configuration file :
gandalf ALL=(ALL:ALL) NOPASSWD: ...
52
votes
1
answer
65k
views
Use fingerprint authentication not only for login
I'm on 18.04 and have successfully enabled fingerprint login. I would like to use my fingerprint not only to login but if possible also to:
Authenticate in the terminal when I do a sudo command
...
34
votes
2
answers
30k
views
/etc/sudoers file corrupted and I can't run 'pkexec visudo' over SSH
Following the instruction here I get:
pkexec visudo
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/usr/sbin/visudo' as the super user
Authenticating as: ...
32
votes
3
answers
11k
views
Why do I need root privileges to umount a drive at the command line, but not in Nautilus? How to change that?
When I insert a thumb drive, media card, or USB hard drive, to unmount it via the command line, I need to use:
sudo umount /media/the_device
But, I can unmount the device in a file manager like ...
24
votes
1
answer
4k
views
When should I use pkexec and when sudo -i?
I wrote an answer advising the use of sudo -i nautilus. I know that gksu is deprecated, and I was under the impression that sudo -i is how we should run graphical applications as root without killing ...
22
votes
3
answers
14k
views
What is the functional difference between sudo su and sudo -i?
Why is one preferred over the other in this example?
sudo su
echo "options iwlwifi 11n_disable=1" >> /etc/modprobe.d/iwlwifi.conf
exit
Please provide links to Ubuntu documentation.
19
votes
2
answers
71k
views
sudo: unable to resolve host ubuntu-server [duplicate]
Every time I try to use sudo I get this:
sudo: unable to resolve host ubuntu-server
My /etc/hosts file:
127.0.0.1 localhost
127.0.1.1 ubuntu-server
# The following lines are desirable ...