sudo - Execute a command with superuser privileges.

learn more… | top users | synonyms

1
vote
2answers
74 views

Script to su -c into a screen is not working as intended

I'm working on a script that will allow me to load up a screen from a user via sudo and su -c. However, when I use it, it will just show the shell of the user: sudo su -c "script /dev/null; screen -r ...
3
votes
10answers
698 views

How to log commands within a “sudo su -”?

If I: [user@notebook ~] sudo echo 123456uu 123456uu [user@notebook ~] Then I can see that in the logs: [root@notebook /var/log] grep 123456uu * auth.log:Jan 9 17:01:51 notebook sudo: user : ...
1
vote
1answer
131 views

How do I change file/directory permission of a nfs mounted directory, so I access files as user?

On a Ubuntu computer I mounted a directory from another computer using the following line in the fstab: 12.34.56.78:/space/Images /mnt/space/images nfs rsize=16384,wsize=16384,rw,auto,nolock 0 0 ...
4
votes
2answers
139 views

How can I find and/or print sudo's lecture file?

I'm using Ubuntu and I would like to find and/or print the sudo lecture that is printed to the screen the first time a user executes a sudo command. How can I do this? I'm unable to find the lecture ...
4
votes
3answers
233 views

How do you process an entire command as sudo that involves redirecting or piping?

I am trying to follow what I assume is best practises of using sudo instead of root account. I am running a simple concat file operation such as: sudo echo 'clock_hctosys="YES"' >> ...
4
votes
1answer
104 views

Is there any point in using `sudo` when you are the sole user of your machine?

I'd like to know if there is any reason why I should use sudo instead of su, taking into account that I am the owner and sole user of my machine (and hence have root access whenever I want). Also, in ...
13
votes
2answers
408 views

Is sudo not installed by default in Debian?

I was reading a guide to install some software and came reading until this shocking statement: sudo is not installed on Debian by default. Make sure your system is up-to-date and install it. As ...
1
vote
2answers
36 views

Running a program to output in Dutch

I'm running KDE Arch linux and trying to update my system using pacman and have it output in Dutch. I've tried the following sudo LANG=nl_NL.UTF-8 pacman -Syy sudo KDE_LANG=nl_NL.UTF-8 pacman -Syy ...
-3
votes
1answer
59 views

where is this HOME environment variable and what do I have to add -H too it?

I recently attempted to run a boot up script which failed I didn't know why it failed so I posted a question about that here. chkconfig bootup script failing, script runs good manually Where the ...
5
votes
2answers
332 views

What would I get when sudo a kernel-destructive program?

It suddenly comes to me how easy it will be for a sudoer to crash the kernel, so I tried something like this: #include<stdio.h> int main(){ printf("hello world"); int a; ...
56
votes
19answers
7k views

Root access that can't change root password?

We are having a little problem on a server. We want that some users should be able to do e.g. sudo and become root, but with the restriction that the user can't change root password. That is, a ...
0
votes
1answer
81 views

Can't access the directory /etc/ppp/peers?

I want to read some configuration file. The problem is that I can't move in the folder peers and typing the command ls -l, I see this permission's record: drwxr-s--- root dip ... I never seen that ...
7
votes
2answers
176 views

How do I edit a file as root?

Are there any special considerations to editing a file as root? What is the safest way to do this?
0
votes
1answer
77 views

Process substitution over ssh with sudo in Bash shell

What is the proper way to do something like this: diff <( ssh -t myuser@hosta 'sudo httpd -M') <(httpd -M) When I want to compare the output of the 2 commands, the first on a remote host the ...
-1
votes
1answer
140 views

How to install sudo package in Unix? [closed]

I'm new to this sudo command. I needed to do sudo mount -o remount. But it is giving me the following message sudo: unable to stat /etc/sudoers: No such file or directory sudo: no valid sudoers ...
7
votes
1answer
80 views

How does the Linux desktop perform system actions?

The Linux desktop can perform several actions which is otherwise not available to the user when logged in from a terminal. Actions such as system shutdown, and changing system time are accessible only ...
3
votes
2answers
1k views

ls *.* gives: “*.*: No such file or directory” message [duplicate]

I'm using Linux app-server 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2+deb7u2 x86_64 GNU/Linux. When I go to a directory with several files named name1.php, name1.html, name2.php, etc. and type: $ sudo ls ...
6
votes
1answer
84 views

Cannot expand asterisk without proper permission

Can someone explain to me the following? $ ls -ld /temp/sit/build/ dr-xr-s--- 3 asdf qwer 4096 Jan 31 2012 /temp/sit/build/ $ ls -ld /temp/sit/build/* ls: /temp/sit/build/*: Permission denied So ...
4
votes
2answers
98 views

Is there something like one-time sudo?

Is there a way to have a one-time sudo account? My use-case is the following. I have an Ubuntu station with no remote ssh allowed to that machine. The machine generally serves as a public-use ...
2
votes
5answers
441 views

How to start a program in the background

The program Boblight does not run in background. There is no noticeable difference between executing sudo boblightd and sudo boblightd& How can I solve this problem that the console will ...
4
votes
2answers
149 views

What are the parameters in sudoers file

The sudoers file has the following line: root ALL=(ALL) ALL I have read that the first field is the user. Then first ALL is all terminals, and (ALL) means as any user, and last ALL means any ...
7
votes
3answers
247 views

Difference between sudo -i and sudo su [duplicate]

I was wondering what the difference is between sudo -i and sudo su?
1
vote
3answers
2k views

sudo: no tty present and no askpass program specified

I have a perl script that I fork from another script that I launch from a web browser via mod_perl. The forked script (which ends up running as apache) needs to sudo service X stop as part of a ...
1
vote
1answer
44 views

Executable not visible when run with sudo [duplicate]

Platform: Ubuntu 10.04 VM running out of VirtualBox File details: -rwxr-x--- 1 myuser myuser 123 2013-10-31 16:10 myscript.sh The executable is visible in the directory: >type myscript.sh ...
1
vote
1answer
142 views

Exiting a Bash script when a sudo child quits

I'm trying to launch a couple of sub-programs from a bash script and then wait on either of them to quit before quitting the other and exiting the script. CMD1PID= CMD2PID= exit_trap () { ...
0
votes
1answer
271 views

Launch application as root user in GNOME

I've got CentOS 6 installed on my server. A few users want to have access to it via VNC, so I installed GNOME separately. Everything works okay, but I want to have possibility to run applications as ...
0
votes
1answer
91 views

sudo mount from webserver (Apache) by mod_php, result not visible by root

Intial question: http://stackoverflow.com/questions/19598201/umounting-through-exec-with-sudo-the-user-is-a-sudoer-with-nopasswd Basically, I have a PHP script, that: exec('sudo mount ...
1
vote
1answer
287 views

ssh with sudo doesn't start services

I want to run command with sudo through ssh without disabling "requiretty" sudo option. According to /etc/sudoers: # # Disable "ssh hostname sudo <cmd>", because it will show the password in ...
1
vote
1answer
47 views

Why doesn't sudo -S work for 'mysql' command?

I generally run sudo mysql database < database.dump and type the password on prompt. In order to automate this, I tried to execute echo 'password' | sudo -S mysql database < database.dump but ...
1
vote
0answers
52 views

can't access account with empty password

I used the passwd command to remove the password for my account. Now, when I try to use su to log in to my account, it won't let me enter an empty password. So now, I can't access my account. Any ...
2
votes
1answer
44 views

Allow a specific user to sudo to users that are part of group X

I have several users, which are all part of group X. And I want to be able to give user Y to sudo to members of group X. Obviously I don't want to edit sudoers everytime I add a user to group X, is ...
0
votes
0answers
19 views

file owner not able to renounce the ownership to root? But root can! [duplicate]

I logged in as username 'ravbholua' I created a file bb as below: ravbholua@ravi:~/Pictures$ echo>bb ravbholua@ravi:~/Pictures$ ll total 12 drwxr-xr-x 2 ravbholua sudo 4096 Oct 13 11:18 ./ ...
0
votes
1answer
140 views

Can't sudo after lock password, can I recover from that?

After setup ubuntu with default settings, It allows user to login with password, so I use passwd -l [username] to forbid password login both in ssh and console. But when I use sudo to execute ...
4
votes
5answers
195 views

Set sudo password differently from login one

As a privileged user I am trying to set the sudo password to another then the one used at login. I have done some research but have not found an answer. Does sudo support that kind of configuration? ...
2
votes
2answers
274 views

difference between windows local admin and unix root

I am trying to understand what is a conceptual difference between unix root account and windows local admin. I am a developer and despite IT department efforts were always given local admin rights so ...
2
votes
2answers
476 views

Unable to run 'sudo chmod +w /etc/hosts'

I am logged into my remote VM (running out of ESXi) as user xyz. I wanted to change my /etc/hosts to add some network names that were not visible by default. I first tried to run sudo vi /etc/hosts ...
1
vote
3answers
372 views

Error : /etc/sudoers not working - Ownership wrong

I have Ubuntu 12.10 on my client system. I have an error /etc/sudoers is owned by uid 1000 should be 0. I tried booting from an Ubuntu live CD and tried: sudo chown root:root /etc/sudoers sudo ...
3
votes
2answers
337 views

Who is file owner if the file is created using sudo command?

I logged in using my username ravbholua: ravbholua@ravbholua-Aspire-5315:~$ echo $LOGNAME ravbholua I create file named a1: ravbholua@ravbholua-Aspire-5315:~$ echo>a1 ...
2
votes
1answer
147 views

Broken sudo on amazon web services ec2 linux centOS

So I had no idea of the dangers of messing with the /etc/sudoers file, and was just trying to make a simple change in there. However, I seem to have put something with incorrect syntax in there, ...
3
votes
1answer
94 views

Keeping sudo authentication with gnome-terminal (zsh)

Can sudo sessions be shared across tabs of gnome-terminal, so that once I use sudo in one tab, I won't have to re-enter my password every time I open another tab and use sudo?
2
votes
2answers
354 views

How can I keep *all* environment vars for a specific command in sudo?

I have a script that sets several environment variables and then finally calls another script using sudo. The script run with sudo must be able to pick up those variables, and I'm not always going to ...
1
vote
3answers
102 views

sudo as another user

I want to run a command on a shell on behalf of another user. The command is as follows: sudo -u USER cd /home/USER I get sudo: cd: command not found What is the correct syntax for the command ...
12
votes
1answer
332 views

How to tell sudo to repeat lecture once?

I'm letting one of my coding buddies have root access to my Raspberry Pi, and as I was getting everything set up, I tested sudo as him. It gave me "the speech": We trust you have received the ...
0
votes
3answers
147 views

How to stop regular users from Switching Users

I want to stop the normal users from using following commands /bin/bash /usr/bin/sudo /bin/su I added them in sudoers file but normal user can still use the following command This is how i add the ...
1
vote
1answer
131 views

How to make sudo accept password automatically without prompting for it? [duplicate]

I created a user named shut so that whenever one logs in using that username the machine would shut down. For that I placed the below command in the end of the .profile. exec sudo shutdown -h now ...
7
votes
3answers
761 views

which shell will sudo use to execute a shell script without the shebang line

My environment is Ubuntu 12.04 LTS, and the sudo version is 1.8.3p1. First I login as a normal user: $ whoami fin $ cat /etc/passwd | grep -i "root\|fin" root:x:0:0:root:/root:/bin/bash ...
2
votes
3answers
324 views

Restrict standard users to run a command with a specific argument

I know how to restrict standard users to run a command by removing execute permissions for that command. But it's possible restrict standard users to run a command with a specific option/argument? ...
9
votes
2answers
117 views

How to automatically enter sudo's grace period upon CLI login?

What I would like to do is be able to login and sudo commands immediately without entering a password again. It is very redundant to type my password twice in a row when I need to login and run a ...
0
votes
2answers
153 views

Pass flags to xargs

I want to kill a bunch of processes using this command: sudo ps ax | grep node | awk '{print $1}' | xargs kill But it gives me operation not permitted even with sudo. Then I tried with kill -9 ...
3
votes
3answers
243 views

Why is PATH reset in a sudo command?

After much frustrating head-brick-wall contact, I've discovered this: $ echo $PATH /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/steve/bin $ sudo bash # echo $PATH ...