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.
2,894
questions
20
votes
5
answers
19k
views
Vagrant Up and annoying NFS password asking
Sorry for the language mistakes I've made.
I'm trying to prevent vagrant asking the password when it mounts shared folders by NFS:
[server] Exporting NFS shared folders...
Preparing to edit /etc/...
20
votes
2
answers
4k
views
How do I prevent access to shutdown but not reboot?
I have a ubuntu pc running as a plex server. How do I get it so that no one can shutdown the computer but only allow the user to reboot the machine? I know it is possible in windows but I am just ...
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/...
20
votes
3
answers
6k
views
Is there a desktop-neutral gksudo?
There are various tools for various desktops that aim to run a graphical application as root. gksudo, kdesudo, empower, etc...
But what if I'm writing a script that could be used on any Linux desktop?...
20
votes
2
answers
19k
views
"sudo cd ..." one-liner? [duplicate]
Occasionally I want to cd into a directory where my user does not have permission, so I resort to sudo.
The obvious command sudo cd somedir doesn't work:
$ sudo mkdir test
$ sudo chmod go-rxw test
$ ...
20
votes
2
answers
31k
views
How do I update sudo package version?
With the news of the vulnerability found in sudo versions prior to 1.8.28, I am trying to upgrade to that version, but have had no luck. I did sudo apt-get update and sudo apt-get upgrade and sudo ...
20
votes
1
answer
92k
views
Error: "dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem" [duplicate]
I think I used something involving dpkg but I am not able to recall what.
After that when I need to do some
sudo-apt
get or even sudo-apt get update I am facing the following ...
20
votes
2
answers
75k
views
When I use sudo pip to install software I get the message "the directory... is not owned by the current user"
The directory '/home/bijay/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If ...
19
votes
4
answers
119k
views
Sudo comes up with an error, cannot run anything as root
For some reason, when I try to run any programs (I am trying to run a rootkit hunter: rkhunter) as root on the command line with sudo like this:
sudo rkhunter
Then I get this message:
You must be ...
19
votes
2
answers
8k
views
Can anyone explain why sudo ls with a wildcard doesn't work?
$ sudo -iu abc ls -ltr /sites/servers/server_instance/logs/access*
ls: cannot access /sites/servers/server_instance/logs/access*: No such file or directory
$ sudo -iu abc ls -ltr /sites/servers/...
19
votes
2
answers
14k
views
warning message at command line `sudo`
Everytime I try to sudo something at the terminal, I get a warning message:
alexandre@XPS-15Z $ sudo mount file.iso /mnt/ -o loop
[sudo] password for alexandre:
no talloc stackframe at ../source3/...
19
votes
1
answer
16k
views
How to make 'sudo' grab the password from a file?
I want to run a command that requires the sudo password say:
sudo apt-get update
Isn't this supposed to work (I have stored the password in a normal text file passwd.txt):
sudo apt-get update <~/...
19
votes
2
answers
43k
views
Error, even with sudo: "dd: failed to open ‘/dev/sda1’: Permission denied" (dd input piped from gzip)
My command which doesn't work:
sudo gzip -dc sda1.image.gz | dd of=/dev/sda1
returns the following error even before I've had a chance to enter my password:
dd: failed to open ‘/dev/sda1’: ...
19
votes
4
answers
129k
views
What is 'sudo tar -xzf'? Why it is used?
I need to know the extensions of xzf and its usage. Is it necessarily to be used in installing a software?
sudo tar -xzf utorrent-server-3.0-ubuntu-10.10-27079.tar.gz
Why this is used?
19
votes
3
answers
17k
views
What is the equivalent of gksudo in Kubuntu/KDE?
In regular Ubuntu (Unity/Gnome), I use gksudo to run GUI programs with root privileges. I'm trying out Kubuntu (or KDE) now -- what do I use?
19
votes
2
answers
408k
views
Installing apt-get
The apt-get command and the sudo command does not work for me. which apt-get returns nothing. I checked by bin folder to make sure, and there is no aptget. I however have wget. Can I install apt-get ...
19
votes
3
answers
55k
views
sudo: unknown uid xxxxx: who are you?
I was using ssh and trying to upgrade a system from Ubuntu 10.04 to 12.04. The connection had an issue so I had to login again to finish the upgrade. After running
sudo dpkg --configure -a
that was ...
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 ...
18
votes
5
answers
328k
views
How to run applications as root?
I am having some strange issue with Kate and Kwrite. When I click on Open File, it crashes with segmentation fault.
I am a complete newbie to Linux, and I think the issue is that I am not running ...
18
votes
1
answer
101k
views
Shutdown over SSH [duplicate]
I just installed a fresh ubuntu server 12.04. I log in over SSH and use sudo -s to get root access. Then I use shutdown now and the server closes the connection. I cannot access the server over SSH, ...
18
votes
2
answers
14k
views
Why doesn't $HOME change if I use sudo?
I expected the -H option to give me the target user's environment.
nbest@geo:~$ sudo -H -u tanum echo $HOME
/home/nbest
nbest@geo:~$ sudo -u tanum echo $HOME
/home/nbest
nbest@geo:~$ sudo -i -u tanum ...
18
votes
4
answers
104k
views
Failed to connect to Mir: Failed to connect to server socket: No such file or directory
After logging in as another user how do I run GUI programs?
thufir@doge:~$
thufir@doge:~$ sudo -u hawat -i
hawat@doge:~$
hawat@doge:~$ whoami
hawat
hawat@doge:~$
hawat@doge:~$ pwd
/home/hawat
...
18
votes
1
answer
4k
views
Get email notification for using 'sudo' by a specific user
I have a server set-up and I let somebody that I trust with a little bit of sudo access have it. However, I also want an email anytime that they use sudo.
I know that I can use Defaults ...
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 ...
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 ...
18
votes
2
answers
11k
views
What's the difference between login as user and changing users using su through root?
When you have a server of some sort you can access it through, e.g., ssh user1@ip and you can also do ssh root@ip to go to your root user with su priveleges and then go to su user1. In my thinking ...
18
votes
1
answer
28k
views
sudo, gksudo, kdesudo and their differences?
What is the difference between sudo, kdesudo and gksudo, and when should I use each? I know that sudo allows me to run both cli and gui functions, but I've seen other people on websites using kdesudo ...
18
votes
5
answers
10k
views
How to make /sbin/shutdown, /sbin/reboot etc. require sudo again in 16.04?
For whatever reason, we do no longer need to be root (or using sudo) to run /sbin/shutdown, /sbin/reboot etc.
This seems to be because those executables are now symlinks to /bin/systemctl which ...
17
votes
5
answers
19k
views
File in /etc/sudoers.d/ not recognized
Running a fresh install of Ubuntu server 16.04.1, I tried to add a file in /etc/sudoers.d/ to give one user root privileges for a certain command.
I added the file /etc/sudoers.d/servicetest with the ...
17
votes
2
answers
31k
views
What does sudo service do?
As far as I know and it seems that other people have the same opinion sudo is a command that executes something with administrative privileges.
However when I run rcconf I can see this line:
[*] ...
17
votes
1
answer
3k
views
What does su > echo "<username>" mean?
When I was entering the command
su > echo "sachin"
it was asking for a password. When I gave my password, some strange things happened as you can see:
One more thing: there is another user, ...
17
votes
2
answers
57k
views
How to switch to root user but stay in the same directory
I recently switched to Ubuntu and I have observed one thing when I use the following command to switch to root user
sudo su - root
It takes me directly to root's home (/root), so I lose my place in ...
17
votes
9
answers
32k
views
How to run an Application as another user?
I use krusader for file management stuff. the problem is that apache's DocumentRoot should be under chown www-data:www-data /path/to/www. so using krusader (which is run under my account) I've not ...
17
votes
7
answers
13k
views
How to prevent system applications (like the Software Center) from asking for password?
I'd like Software Center, Update Manager and some other system management applications to work without asking for password (like sudo does if configured with NOPASSWD) but only asking for a ...
17
votes
1
answer
40k
views
sudo does not ask for password [duplicate]
Whenever I issue command sudo apt-get install foo it does not ask for password.
is it because of user groups?
How to make it prompt for password?
Edit: My sudoers file
apple@Ascension:~$ sudo cat /...
16
votes
3
answers
8k
views
Is ./ (dot slash) a command?
Core of the question:
The question arose while I could not install the software, so I am genuinely asking about ./ because I didn't know about it and the output "command not found" was confusing me ...
16
votes
4
answers
113k
views
How to check if running as root? Not asking for sudo
I am a new Ubuntu user and am still getting used to the OS. I have been using it primarily for local testing of a site that I am developing. I downloaded the LAMP stack for this.
When I first ...
16
votes
3
answers
64k
views
What's the difference between 'sudo [command]' and 'sudo sh [command]?
I'm trying to install VMware Workstation in my Ubuntu 12.04.2 LTS.
If I execute the following command:
sudo ./VMware-Workstation-9.0.1-894247.x86_64.bundle
it finishes at once and the installation ...
16
votes
3
answers
6k
views
Where is the login shell defined?
I was reading difference between sudo -i/-s here. After using command shopt it is noted that all(sudo su/sudo -i/sudo -s) the $SHELL are providing same results, but shopt command results are different....
16
votes
1
answer
28k
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, ...
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
3
answers
6k
views
pipe to sudo -E bash -
I was wondering what is the purpose of piping the downloaded file by curl into sudo -E bash - in the following shell:
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
16
votes
1
answer
45k
views
Is /etc/sudoers file only suppose to have read only permissions?
-r--r----- 1 root root 723 Jan 31 2012 sudoers
My dist-update frequently fails.
At boot my system frequently asks for file system check. (My system-hardware is file)
I am using
vksTP 3....
16
votes
1
answer
3k
views
What happens if you use @reboot reboot in crontab file?
What would happen if you use:
sudo crontab -e
And add the line:
@reboot reboot
Will it go into a infinite loop of rebooting?!
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 ...
16
votes
3
answers
27k
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 ...
15
votes
2
answers
43k
views
"~/.wine is not owned by you", am I safe?
So I was running about trying to install something in wine when I encountered the suggestion to use sudo to get administrator privileges. That's when I got the above message
~/.wine is not owned by ...
15
votes
4
answers
6k
views
I change the last line in /etc/passwd and I can't use sudo
Here is what I have done:
Change a username in the last line: tiny to abc
tiny@tty7:~$ sudo vim /etc/passwd
Change this:
tiny:x:1000:1000:tiny,,,:/home/tiny:/bin/bash
to this:
abc:x:1000:1000:tiny,,,...
15
votes
2
answers
190k
views
Launch Sublime Text 2 from terminal [duplicate]
I am new to Ubuntu and is trying to configure my environment so i can launch Sublime Text 2 directly from the terminal. I followed the solution on this post but no luck so far.
These are steps I did (...
15
votes
2
answers
12k
views
Upgrade sudo to 1.9.5p2 version due to CVE-2021–3156 vulnerability [duplicate]
How do I upgrade sudo to version 1.9.5p2? I use Ubuntu 20.04. I have already tried:
sudo apt-get update
sudo apt-get upgrade
But I am still on version 1.8.31.