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
27
votes
8
answers
5k
views
How to make super-user permissions last longer than using sudo?
Is there a way through which I can make the sudo command give me permissions for a longer period than its default time?
It can be a pain having to keep entering the sudo password, when requiring the ...
25
votes
1
answer
60k
views
How to run a command as a user whose login is disabled?
I am trying to use the su command to run an application as another user
In this case I am trying to run irssi
blah@ubuntu: su - [username] irssi
(enter password)
blah@ubuntu:
(nothing happens)
...
24
votes
3
answers
35k
views
Why can't sudo find a command after I added it to PATH?
I want to add some command to PATH so that I can use them conveniently, such as:
export $PATH = "$PATH:/opt/storm/bin"
but sometimes storm need root authority, but when I use it with sudo, Ubuntu ...
23
votes
1
answer
20k
views
Skipping acquire of configured file in ubuntu 20.04 LTS [duplicate]
I have recently updated to Ubuntu 20.04 and I am a bit fresh user for ubuntu. after installing postgresql 12 I ran sudo apt-get update it says
N: Skipping acquire of configured file 'main/binary-i386/...
23
votes
1
answer
23k
views
I accidentally removed myself from sudoers, how can I fix this? [duplicate]
I have one admin account and recently I have accidentally added myself to a single group (usermod -G without -a).
So, I am not in the sudoers file any more. However, it is not possible to log in to ...
22
votes
8
answers
18k
views
Setting TeX Live path for root
I have installed TeX Live 2011 vanilla and I have trouble setting the TeX Live path for root (in Ubuntu 11.10).
The problem is that when I run sudo tlmgr I get:
sudo: tlmgr: command not found
To ...
21
votes
6
answers
65k
views
Always Sudo Privileges
I've searched for this, and the answer is probably in a million places on the 'net, but I can't find it...
How do you give your account root privileges in Linux so that you don't need to sudo every ...
20
votes
3
answers
98k
views
How do I run commands as a non-root user in a script started with root permissions?
The problem
In a bash script, I am using the command...
sudo -u node bash
.. to switch from root to a non-sudo user, and this is failing.
The context
I am writing a provision.sh script for Vagrant, ...
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
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/...
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
2
answers
30k
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:
[*] ...
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 -
14
votes
1
answer
11k
views
What does '-H' flag in 'sudo -H' mean?
When I was installing Python 3 on Ubuntu 18.04, I came across the command
sudo -H pip install -U pip
What does -H do?
13
votes
1
answer
4k
views
Is first Ubuntu user root?
When I set up Ubuntu system for the first time, and create first user, will that user be root? I would like to use sudo user, so how to add it if first user is root? Also is it possible to create sudo ...
11
votes
4
answers
37k
views
Deleted Myself from Admin Group - Now Getting Error usermod: cannot lock /etc/passwd; try again later [duplicate]
Possible Duplicate:
Cannot lock '/etc/group' in recovery mode
I have a laptop with Ubuntu 11.10 that is shared between myself and two other family members. My user id was setup as the ...
10
votes
4
answers
3k
views
Why does echoing these parameters with sudo not work? [duplicate]
Possible Duplicate:
sudo & redirect output
These are suggestions given by powertop to save energy:
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
echo 1 > /sys/module/...
10
votes
3
answers
7k
views
Why I must use 'visudo' to edit the '/etc/sudoers' file?
In /etc/sudoers, it says:
# This file MUST be edited with the 'visudo' command as root.
My question is, why must this file be edited with visudo?
It seems I was able to edit the file successfully ...
10
votes
2
answers
4k
views
What is the difference between sudo -i and sudo -s? [duplicate]
I am a new Ubuntu user and find some people tell me to use sudo -i to get root and others tell me to use sudo -s. What is the difference? Which one do I use and when?
10
votes
3
answers
3k
views
Ignore sudo in bash script
I have a small bash script:
#!/bin/bash
touch dummy.txt
If I execute this script with sudo then it will create dummy.txt which will be root protected.
What I want to do is:
Regardless of whether ...
10
votes
1
answer
8k
views
How can I change the number of password entry attempts allowed by sudo?
By default, sudo prompts me to input my user password a maximum of three times if I input wrong password. How can I change it to unlimited times(?)? How can I make it so that it asks me for my ...
9
votes
3
answers
16k
views
Run script as root at login (no sudoer user, shell session)
Much like /etc/profile and ~/.profile but ran by root instead of the user is doing login. /etc/rc.local runs after boot but I need running the script before login. The user is not a sudoer one.
...
9
votes
1
answer
5k
views
How can I automate a "conffile" prompt in unattended upgrades?
We have many systems, managed via Ansible. They are configured to run nightly security updates. We have a problem because the sudo package wants to put in a new /etc/sudoers. This is what now happens ...
9
votes
1
answer
4k
views
Accidentally deleted 'sudo' [duplicate]
I accidentally deleted the /usr/bin/sudo file. How can I restore it?
I have found a thread on ubuntuforums, but it seems to be not solved.
8
votes
2
answers
38k
views
How to reset default permissions for /etc? [duplicate]
By mistake I have made permission changes for /etc. Now it's giving me the following error message:
bash: /etc/bash.bashrc: Permission denied
I have no name!@chandan-Inspiron-5520:~$ sudo /etc/init....
7
votes
3
answers
8k
views
How to make sudo remember my password and how to add an application to startup
I guess this should be a simple thing for ubuntu users out there. I have two questions.
Whenever I need to run some command that requires permission from root, I run as sudo followed by that command. ...
7
votes
3
answers
9k
views
How to run a Desktop graphical application just once under sudo?
For example, I'm trying to run Archive Manager from Ubuntu Desktop (10.04) under sudo otherwise it won't let me extract a Software Development Kit into /usr/local
Update: I don't want sudo to be a ...
7
votes
1
answer
17k
views
how to shutdown a linux machine, including the root password, in 1 line?
How do you include the root password, say for shutting down an ubuntu machine?
like,
sudo shutdown now
is it possible to include the password on this 1 line? like an extra parameter?
reason for ...
7
votes
1
answer
17k
views
problems with sudo permissions - /var/lib/sudo owned by uid
my system is a new 11.04 ubuntu and i recently started working with LAMP.
some how, when i tried to change permissions of the var/www/ for netbeans to work on the local server, and did something that ...
7
votes
1
answer
32k
views
How do I allow only one user to su to another account?
I have user-a and user-b on my box.
How do I do a no-password su - user-b as user-a?
7
votes
7
answers
10k
views
Is the command `sudo rm /Desktop/filename` safe?
Is this safe to use?
sudo rm /Desktop/FILENAME
The reason for wanting to use sudo is I can't see the file.
I accidentally typed in sudo rm /Desktop/index.html. It didn't find it but could ...
6
votes
3
answers
56k
views
no space in disk; sudo apt-get clean not working
I have been trying to update my xubuntu version but it keep saying there's no enough space on disk. The window says me to execute "sudo apt-get clean" but I have no answer. It just don't do anything.
...
6
votes
2
answers
3k
views
Why doesn't the command do-release-upgrade doesn't require sudo?
I was wondering why the command do-release-upgrade doesn't require sudo? I mean, it does significantly change your system, so I would have guessed it requires sudo.
This is from ubuntu self, but it ...
6
votes
2
answers
7k
views
Can't change the owner back to the root (can't use sudo command) in WSL Ubuntu
I faced this issue when I want to use sudo command :
sudo: /etc/sudoers is owned by uid 1000, should be 0
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
then ...
6
votes
1
answer
8k
views
vim unable to write to files even though sudo is used
I find that with vim, if I try and edit a file which as a normal user I do not have write access with, even if I use sudo, I am unable to write to it, although if I use nano to edit the same file it ...
6
votes
1
answer
3k
views
How can I make stars appear when I type sudo password? [duplicate]
For most applications when you type a password stars or asterisks (*) appear to indicate each key you've typed. However, when you type sudo and are prompted for a password nothing appears as you type.
...
6
votes
3
answers
4k
views
How do I tell a shell script my password?
I've been trying to create a script that runs sudo apt-get update and sudo apt-get autoremove whenever I log in. It goes like this:
#!/bin/bash
(sudo apt-get update)
(sudo apt-get autoremove)
But ...
5
votes
2
answers
6k
views
Run Bash Script as Root
Is there some way I can run a Bash script as root without being prompted for a password every time? I'm attempting to automate the process of starting my LAMPP install, which requires me running a ...
5
votes
1
answer
1k
views
How is the guest account prevented from using su and sudo?
It's already known that the guest account can't use su or sudo:
Why is su disabled from guest sessions?
Sudo not available in guest login
How is this done?
My guess would be apparmor. However, ...
4
votes
2
answers
7k
views
how to restore boot folder?
No laughing!
I just did sudo rm -vr /boot/*. Is there a way to restore the content?
Just to clarify why I would do this: I have a SD-card with a boot-partition mounted at /media/boot that I wanted ...
4
votes
2
answers
1k
views
Create user ID `root` to force `gedit` to create user configuration file
When using sudo powers and calling gedit the top level menu with File Edit View Search Tools Documents Help is missing.
If I create user ID root and sign in once and call gedit will it create the ...
4
votes
1
answer
1k
views
Can I make `sudo` follow my path via CLI?
You can edit sudoers file and set secure_path to match your path. This is documented in Unix & Linux.
Is there a command line switch I can pass to sudo such that it uses the path I have set? For ...
4
votes
1
answer
8k
views
Ubuntu terminal cant type special characters like backslash (\), slash(/), semicolon (:), etc properly
I'm running Ubuntu 14.04 without GUI and i'm having problems entering characters like backslash, slash, semicolon and so forth. The keys which would normally enter these characters print out all kinds ...
4
votes
2
answers
6k
views
Problem installing ruby and gems
I just installed ruby using apt-get with the following command:
sudo apt-get install ruby1.9.1-full
But when I try to do sudo gem install ... it says that I have not installed gems and that I shoud ...
4
votes
3
answers
36k
views
Permission denied for all sudo comands
I just typed "sudo chmod 770 ." on my /usr/bin directory by mistake
[acc]:/usr/bin$ sudo chmod 770 .
Now every time i run a sudo command I get a "Permission denied" error
[acc]~$ sudo
bash: /usr/...
4
votes
1
answer
4k
views
"sudo pip" differs from normal "pip"
When I execute
which pip3
it points to
/usr/.../anaconda3/bin/pip3
However, when I run
sudo which pip3
the result is
/usr/bin/pip3
Where does this problem comes from and how do I achieve ...
4
votes
3
answers
9k
views
sudo: /var/lib/sudo writable by non-owner (040777), should be mode 0700
I get error message always when I work with sudo command.
It shows always sudo: /var/lib/sudo writable by non-owner (040777), should be mode 0700.
A while ago I changed the permission of /var ...
4
votes
2
answers
5k
views
Why do I need sudo? [duplicate]
This is a question from a rookie just trying to understand how and why things work like they do. Why do I have to use sudo everytime? The second use of sudo in a term session doesn't require a ...
3
votes
1
answer
12k
views
Run script with arguments as sudo without being asked for password
I have two programs in Java that I'm calling from bash script:
java program1 arg ... arg
sudo java program2 arg ... arg
I want to run program2 as sudo without being asked for password. I'm aware of ...
3
votes
5
answers
57k
views
sudo must be owned by uid 0 and have the setuid bit set
I am trying to run the following command:
$ echo "My username is: `whoami`"
My username is: d
$ sudo chown -R `whoami` /usr/local/lib/node_modules
sudo: /usr/bin/sudo must be owned by uid 0 and have ...