sudo - Execute a command with superuser privileges.

learn more… | top users | synonyms

2
votes
1answer
59 views

Secure way to allow any user to run programs in specific network namespace

I have a cell modem connected to my server that I want to use as a means to get notification emails out when the landline dies. To nicely separate normal network access and this exceptional cell ...
1
vote
1answer
2k views

exclude commands from user's sudo permissions

Consider the following line in a /etc/sudoers file: username ALL=(ALL) ALL, !/usr/bin/passwd as far as I know, this allows user username to use sudo, unless he not uses /usr/bin/passwd. But ...
3
votes
3answers
139 views

SUID accidently removed from /bin/su file

It is a production server - CENTOS 6.1 Some user having root access in the past had logged on to the server and removed the SUID bit from the /bin/su file and then exited root. Now we are not able to ...
1
vote
2answers
135 views

How do I use my own local text editor to modify system (requires root to save) files on a remote system?

I've recently fallen in love with github's Atom text editor, and I enjoy using it for all my local coding and configuration. I started to maintain a Nagios installation for several dozen servers and ...
2
votes
1answer
25 views

Sandbox an account and prevent it from any system modifications

I am trying to sandbox a user account to the point where it cannot edit or view any files beyond a certain folder, namely /home/user/test. This account will be compiling and running a C++ program that ...
0
votes
1answer
183 views

Restore sudo privileges

Trying to install tor-browser, I screwed up my sudo privileges when I tried to take ownership of a directory. Now I get a message: sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit ...
1
vote
1answer
89 views

su or sudo keeping/removing certain environment variables

I would like to be able to log in as another user and keep most, but not all of my environment. Specifically, I would like to set $HOME to the correct value for the new user, but keep probably ...
1
vote
2answers
59 views

Why does sudo ask for a password?

USER@notebook:~/foo/notebook$ sudo /usr/bin/mplayer /home/USER/foo/notebook/something.mp3 [sudo] password for USER: USER@notebook:~/foo/notebook$ USER ALL=(ALL) NOPASSWD: /usr/bin/mplayer ...
10
votes
3answers
3k views

Stay at same working directory when changing to sudo

When working on the command line, I often change to sudo using sudo -i. However, my working directory changes automatically to /root. I never want to go there; I want to stay where I was! How can I ...
2
votes
2answers
4k views

How to execute changes on remote server as root?

I'm wondering if there is a way to execute a script/commands from the the local machine without making any modifications as root on the remote machine? Some background I'm trying to setup some tasks ...
8
votes
4answers
4k views

Copying protected files between servers in one line?

I'd like to copy squid.conf from one server to another. The servers don't talk to each other. I'd like to go through my workstation. Both servers have the file, so it will be overwritten on the ...
1
vote
3answers
84 views

How can I make sudo forget the password automatically after one command?

My problem is the following: I want to edit a file that is only readable by root. That's why I use sudo vim ~/thefile I could type sudo -K after exiting vim, but I was hoping that there's an ...
0
votes
1answer
53 views

Is it possible to capture SSH+sudo output locally without writing the hostname and [sudo] lines?

Is it possible, when locally writing output from SSH command execution, to suppress the hostname and [sudo] lines? For instance, when I SSH into a server and run sudo <command> it displays ...
0
votes
2answers
48 views

Is there a sudoedit equivalent for vimdiff?

I'm trying to get into the habit of editing root-owned files with sudoedit, instead of sudo vim. This has a few advantages, one of which is that it uses my user's ~/.vimrc. Is there an equivalent, ...
1
vote
1answer
47 views

Different password for login and sudo - security concerns

I'm planning to follow the steps described in this answer to have a different password to log in and sudo. The reason is that I want a high security password to access my account or unblock the ...
17
votes
1answer
12k views

sshfs mount, sudo gets permission denied

I am using sshfs to mount a folder with some python projects over ssh to my ~/ directory. $ mkdir -p ~/mount/my-projects $ sshfs user@example.com:/home/user/my-projects ~/mount/my-projects I can ...
0
votes
1answer
239 views

C/C++: Running multiple commands as root

I want to execute commands within my C program. However, I need root priviliges to create some folders. I run the following: system("echo <rootpass> | sudo cd <folder> && make ...
2
votes
2answers
14k views

How to kill a process that says “Operation not permitted” when attempted?

I have a process I would like to kill: computer@ubuntu:~$ ps aux | grep socat root 2092 0.0 0.0 5564 1528 pts/1 T 14:37 0:00 sudo socat TCP:xxx.17.29.152:54321 ...
1
vote
1answer
103 views

How do I install some required libraries for a program without sudo?

I am trying to run a program on a computer running Red Hat 6.5. This results in the three following errors: "/lib64/libc.so.6: version `GLIBC_2.14' not found" "/usr/lib64/libstdc++.so.6: version ...
3
votes
2answers
1k views

Programatically use visudo to edit sudoers?

I have a sudoers file stored in our svn repo. I want to svn export it to /etc/sudoers but can't do it because sudo detects that it was not edited by visudo and throws syntax errors. What exactly does ...
2
votes
3answers
108 views

How to launch xev from console?

I am trying to launch Xev from console, it always gives "unable to open display", I need to launch xev from a console as another user (I use sudo -u '#1000' to do this). I know xev has a "display" ...
0
votes
2answers
55 views

Ubuntu CentOS RHEL cross bash script su support

I know that title was a little ambiguous. Allow me to explain our issue. We designed an installer script on Ubuntu since Debian based systems are our primary core, however, some of our cloud based ...
-1
votes
1answer
47 views

sudo issue during echo something to a root file [duplicate]

I have a problem, during write something into a root file: $ ll /sys/bus/usb/devices/3-2/power/wakeup -rw-r--r-- 1 root root 4096 Feb 16 17:28 /sys/bus/usb/devices/3-2/power/wakeup $ sudo echo ...
2
votes
3answers
522 views

Why does sudo ignore aliases?

I am running Ubuntu 10.04 and I use upstart for daemon management. My enterprise application is run as a daemon and must be run as root because of various privileges. E.g.: sudo start ...
24
votes
3answers
11k views

If I sudo execute a Bash script file, will all commands inside the Bash script be executed as sudo as well?

I want to write an automated post-installation script in Bash (called post-install.sh, for instance). The script will automatically add and update repositories, install and update packages, edit ...
0
votes
0answers
12 views

Will I be able to install a service as a sudoer?

I will need to install a custom application as a service on a RHEL 6.2 box this weekend. Will I be able to do this with sudoer powers or will I need the root password for anything?
0
votes
1answer
63 views

Sudo User: Not able to see the home directory of other users

I created sudo user hrsupport with following commands: hrsupport ALL=ALL, NOPASSWD: /bin/chown, /bin/chmod, /bin/chgrp, /scripts/pkgacct, /scripts/restorepkg How can I achieve this The hrsupport ...
1
vote
1answer
54 views

File that is only readable with root privileges

I have a binary file that needs to run at startup on all accounts (including unprivileged user accounts), so a command to run it will be put into /etc/rc.local. The program itself will have only ...
3
votes
1answer
43 views

Puzzle over sudo and paths

I have a couple of programmes which are in /usr/local/bin which require root privileges to run. If I run sudo my_prog I get sudo: my_prog: command not found I have to write sudo ...
4
votes
2answers
805 views

Running programs as root with my own password in Scientific Linux/Red Hat/Fedora/CentOS

In Debian-derived Linux distros, if you are not root but are authorized in /etc/sudoers, GNOME will ask you for your own password to allow privileged operations. However, Scientific Linux asks you ...
1
vote
1answer
43 views

Hotkey for doing sudo suggestions

On Ubuntu and Debian, often if I try to run a program I will get a message that says something to the effect of: You don't have that program. To get it type sudo -apt -get -install programName ...
7
votes
4answers
14k views

How to get back sudo on Ubuntu?

I have done this: sudo chown -R myname /usr/ and now I can't use the sudo command because of this error: sudo: must be setuid root And as I read this means that the owner of this file ...
24
votes
6answers
3k views

Why is it risky to give sudo vim access to ordinary users?

I'd like to create a new user and give him sudo access. To be specific, I want him to use sudo vim and edit httpd.conf. I wrote this in sudoers: user ALL=(ALL) /usr/bin/vim ...
0
votes
1answer
44 views

finding and replacing text [duplicate]

Does any one know how to find and replace text in a file. it can be implimented into a bash file. i would like to find the line and the output the text to it the file can only be opened with the root ...
4
votes
1answer
788 views

Can I run a command loaded from .bashrc with sudo?

I have some custom functions and aliases defined in my .bashrc file. Sometimes I need to execute whem as root. I then do something like: $ sudo custom_cmd 80 ...
0
votes
1answer
891 views

ERROR: no tty present and no askpass program specified ; TTY=unknown ; PWD=/ ; USER=root ; [duplicate]

In my /etc/sudoers.d/myAppCommand file I set some command like this. Cmnd_Alias APP_CMD = /opt/myApp/lib/app-start, \ /opt/myApp/lib/app-stop, \ ...
0
votes
1answer
72 views

How to add “sudo” group

I've done a mistake: I've removed the 'sudo' group, because I have forgotten the -a option (I wanted to add 'video' group): sudo usermod -G video $USER Now, when I want to call sudo I have this ...
0
votes
1answer
67 views

“Sudo” prefixed command doesn't work; without sudo does.

I suspect this has been answered before, but I don't know what this is called, so I can't really search for it. How come this works : $ grep H=p <(udevadm info /dev/ttyUSB0) E: ...
6
votes
2answers
99 views

Linux graphical password dialog trick security

When we run a command by sudo, the password is asked [sudo] password for user If the sudo is not typed the password should not be asked. If asked, I would assume it as a fraud by the application. ...
2
votes
2answers
191 views

What is the meaning of sudo sudo?

I am using Cloud9 for Rails development and it uses an Ubuntu environment. In the documentation about using the PostgreSQL database, it says: Connect to the service: $ sudo sudo -u postgres psql ...
1
vote
2answers
41 views

sudo command is unsucessful when invoked from file manager

I'm trying to run the following script on an install of Fedora 20. #!/bin/bash password={password} echo "$password" | sudo -Sk /bin/bash -c '[[ $EUID -eq 0 ]]' [[ $? -ne 0 ]] && zenity ...
4
votes
2answers
1k views

Is 'echo “Defaults insults” >> /etc/sudoers' safe?

Is this safe? echo "Defaults insults" >> /etc/sudoers If yes, can I do this? echo "## First line" >> /etc/sudoers echo "### Second line" >> /etc/sudoers echo "Defaults ...
10
votes
3answers
583 views

Why does the root user need sudo permission?

[root@notebook ~]# grep root /etc/sudoers root ALL=(ALL) ALL Question: Why does the root user need sudo permissions? I've seen it on different UNIX OSes. Can someone please explain this?
1
vote
2answers
110 views

Locked out of my own mac terminal?

So recently, some of my friends had been tampering with my files and data through terminal, so I decided to secure it by doing two things: First, I added the following to my ~/.bash_profile for ALL ...
0
votes
1answer
40 views

Sudoers - group managing and reboot/shutdown

I've got a group (let's say name "group1", ID = 1234) and a user (let's say name "user1", ID="4321"). I want to do two things: I want that user to change passwords from other members of that group, ...
4
votes
3answers
429 views

Should I be using 'sudo' in scripts that I write?

I'm setting up a new machine (well actually, an Ubuntu VM) and am trying to write a script to setup a few common things that I use when doing this (Git, curl, vim + janus). So my script looks a bit ...
0
votes
1answer
72 views

How does sudo -E work here?

I executed the following command to add a ppa repository in Ubuntu: sudo add-apt-repository ppa:ppaname/ppa This command returned an error that the ppa name format is not correct. Then I looked here ...
2
votes
1answer
112 views

Use current user environment variable in sudoers file

I want some of my users to be able to change their password with sudo command because at the time they log in, they are passwordless (ssh keys connection). My users have no password (and this is ...
1
vote
1answer
50 views

Difference between sudo make and sudo -s ; make

What are the differences between sudo make and sudo -s make First example do not work with my software, there is always a header file missing. Login as root with sudo -s and compile works fine. ...
0
votes
1answer
730 views

how to use command args in sudoers file Cmnd_Alias?

How do I specify command arguments in sudoers? As a background, aws command is actually a gateway to a whole bunch of sub-systems and I want to restrict the user to only run aws s3 cp ...any other ...