Browsing articles tagged with "sudo - Admins Goodies"
Feb 15, 2013
tom

Allow complex sudo command on Debian Linux

I need to allow a specific command on a Debian Linux box for a single user. I’ve tried this in the /etc/sudoers file: # User privilege specification zabbix ALL=NOPASSWD: /usr/bin/apt-get –print-uris -qq -y upgrade 2>/dev/null |awk ‘{print $2}’ | wc | awk ‘{print $1}’ This does not work as expected. If I run the command as user zabbix with sudo, it asks for the password (although I have specified the NOPASSWD option). However, this works: [...]

Continue Reading »
Feb 14, 2013
tom

Linux: Allow complex sudo command

I need to allow a specific command on a Debian Linux box for a single user. I’ve tried this in the /etc/sudoers file: # User privilege specification zabbix ALL=NOPASSWD: /usr/bin/apt-get –print-uris -qq -y upgrade 2>/dev/null |awk ‘{print $2}’ | wc | awk ‘{print $1}’ This does not work as expected. If I run the command as user zabbix with sudo, it asks for the password (although I have specified the NOPASSWD option. However, this works: [...]

Continue Reading »
Feb 8, 2013
tom

Save file after forgetting to open as root / sudo vi [duplicate]

Possible Duplicate: vim re-edit as root I could have sworn I saw this question asked. But after looking though every search result for “vi” I’m stumped/lazy. I’ve opened a file, made an edit and now I realize it’s read only and I’ve opened it as non-root me. Asked by MathewC I think you want something like this: :w !sudo tee “%” I first saw it on commandlinefu. The quotes are only necessary if the file [...]

Continue Reading »
Dec 30, 2012
tom

Advice regarding SUID and sudo on Ubuntu Server

Just wanting a bit of advice. I have root access to a server and I want to create a second user and execute everything via sudo should I need to rather than logging in as root. The file /etc/sudoers reads as: Defaults env_reset root ALL=(ALL) ALL %sudo ALL=(ALL) ALL I have added a second user “bob” to the system and added them to the group sudo which should ensure that they can execute root commands. [...]

Continue Reading »
Dec 23, 2012
tom

visudo syntax error

What am I doing wrong here as this line is making visudo fail dhiller2 ALL= ALL, !NSHELLS, !NSU NOPASSWD: ALL this line works dhiller2 ALL= ALL, !NSHELLS, !NSU How to fix this? and yes, I know there are ways to get around this…this is just to remind our admins that policy is not sudo su – and you should be using sudo to run all commands. thanks, Dean Asked by Dean Hiller Use it like [...]

Continue Reading »
Dec 5, 2012
tom

“Target the specific user you will be using and assign it user id 0/group 0”

I am trying to virtualize an Ubuntu machine using VMWare vCenter Converter, but ran into permissions issues. I followed the instructions of part 1 and 2 on this page but when I got to “For Ubuntu operating systems further configuration is needed” I started running into trouble. I’m decent at Linux, but I’m not an experienced sysadmin. How do I Target the specific user you will be using and assign it user id 0/group 0? [...]

Continue Reading »
Oct 23, 2012
tom

ifdown em1 Users cannot control this device. Allow users to control em1 device

I want to allow users to control the em1 device in Linux: When I run this command: ifdown em1 em1 is the embedded ethernet card 1, I want the user to be able to turn off the ethernet card. On Fedora 17, I get this error message: Users cannot control this device I want a certain user to be able to run a certain command on Linux without giving rights to other users. What is [...]

Continue Reading »
Sep 3, 2012
tom

How can I execute a bash function with sudo?

I have a bash function defined in a global bashrc, which requires root privileges to work. How can I run it with sudo, e.g. sudo myfunction. By default it gives an error: sudo: myfunction: command not found Asked by eugene y Luca kindly pointed me to this question, here’s my approach: Expand the function/alias before the call to sudo and pass it in its entirety to sudo, no temp files needed. Explained here on my [...]

Continue Reading »
Aug 17, 2012
tom

Calling sudo within a script that was called with sudo prompts for password even with NOPASSWD

A PHP program I am working with (LConf) calls a script using sudo. I have allowed the user apache to run the script and have tested with sudo -u apache /usr/local/LConf/lconf_deploy.sh. I am being prompted for a password when lconf_deploy.sh calls /usr/bin/sudo -u icinga /usr/local/LConf/LConfExport.pl -o /etc/icinga/lconf -v, but have no problems calling lines before or after this line. After reading a lot (both on stackexchange and elsewhere on the internet) about what to do [...]

Continue Reading »
Aug 11, 2012
tom

x11vnc through SSH tunnel – sudo: no tty present and no askpass program specified

I’m trying to setup a one-time SSH tunnel which instantiates x11vnc on a logged-in display. ssh -f -t -L 5900:localhost:5900 user@10.1.10.1 ‘sudo /usr/bin/x11vnc -safer -once -nopw -display :0 -auth /home/user/.Xauthority’ /etc/sudoers: user@myhost:~$ sudo cat /etc/sudoers [sudo] password for user: # # This file MUST be edited with the ‘visudo’ command as root. # # Please consider adding local content in /etc/sudoers.d/ # instead of directly modifying this file. # Defaults:user !requiretty Defaults env_reset Defaults secure_path=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin”root [...]

Continue Reading »
Pages:1234567...18»