sudo - Execute a command with superuser privileges.

learn more… | top users | synonyms

3
votes
3answers
253 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 ...
1
vote
1answer
106 views

How to pipe to bash as a different user

I am running an experiment as a way to solve a bigger problem. For the experiment, I need to install rvm as a user who does not have a shell. To install rvm, you use the following command \curl -L ...
2
votes
3answers
936 views

Allow a user to view the home directory of other users via sudo

I am new to system administration. We have a lab set up where we have a server and client machines. The client machines have LDAP users which has the work area for all the users in the centralized ...
5
votes
5answers
780 views

How is sudo set to not change $HOME in Ubuntu and how to disable this behavior?

On Ubuntu 12.04, when I sudo -s the $HOME variable is not changed, so if my regular user is regularuser, the situation goes like this: $ cd $ pwd /home/regularuser $ sudo -s # cd # pwd ...
1
vote
2answers
125 views

Can't run su after changing permissions to su file

I am running Linux Slackware 14.0. I wanted to allow to do su only to the members of wheel group, so I modified the permissions of /bin/su and /usr/bin/sudo files to this: bash-4.2# ls -la /bin/su ...
3
votes
1answer
509 views

sudo askpass: ask from other tty

Context I want to setup rsync backups of my server, so I run the following command rsync -r -e ssh --rsync-path="sudo rsync" rsyncuser@example.com:/ /backup/ Ideally, that command would ask my ...
4
votes
2answers
236 views

“nohup sudo …” does not prompt for passwd and does nothing

When I run nohup sudo myscript.sh & I only get something like [1] 1220 in return and do not get prompted for a password. The process does not start either. I want to run this script in the ...
11
votes
4answers
781 views

Can you give a user account multiple passwords?

I want to assign 2 passwords to a single account. What I want to know is 1) is this possible, and 2) what are the security implications of this? The reason I want to do this is because I'm currently ...
4
votes
1answer
179 views

sudo: don't ask password when logged in with ssh key

I'd like to setup sudo in such a way that it doesn't prompt me for a password when I authenticate to sshd with a key; but do otherwise. I don't want an answer of "it doesn't work like that" because ...
5
votes
2answers
192 views

If I type “sudo” at the beginning of a one liner, does it apply to the rest of the commands?

If I type sudo at the beginning of a one liner in bash, does it apply to the rest of the commands? In other words, is this: sudo foo | foo2 | foo3 equivalent to this: sudo foo | sudo foo2 | ...
0
votes
2answers
2k 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 ...
0
votes
1answer
381 views

Allow www-data to perform specific commands

I need a PHP script to perform git pull however I am not naive enough to give it permissions on git. I've wrapped git pull in a script which www-data has permissions for, but I'm not sure how to give ...
2
votes
2answers
110 views

Securely allowing users to create accounts

1) I'm struggling to find a secure way to allow new users to create accounts without granting them admin rights to do so. If you already have an account on my system and can work UNIX command line, ...
3
votes
2answers
529 views

Difference between root account and administrative account

If a user with administrative privilege can have all the powers of root using sudo , then what is the advantage of having root account?
2
votes
3answers
132 views

sudo command after long sleep call without re-prompting sudo password

I'm trying to write a simple bash function that sleeps X-number of mins and then runs a system sleep command (for me it's sudo pm-suspend since I'm on Ubuntu) right now the function looks like this: ...
1
vote
3answers
148 views

Installation script needs to be run as a certain (regular) user but needs to create a system directory

I'm new to Linux, let me explain the issue. I'm trying to install comsol with some sort of network license. If I use sudo ./setup the server directory does not recognize the username "root". The ...
3
votes
1answer
302 views

Can edit file as root, but not using sudo

I just faced a really strange situation. I was trying to edit file /usr/lib/thunderbird/thunderbird.sh, which has the following permissions: $ ll /usr/lib/thunderbird/thunderbird.sh -rwxr-xr-x 1 ...
5
votes
4answers
774 views

Why can't we execute a list of commands as different user without sudo?

This question has been asked in a different way in other forums. But there has not been a decent explanation why you can't do the below in bash. #!/bin/bash command1 SWITCH_USER_TO rag command2 ...
-1
votes
2answers
5k views

How to properly configure sudoers file, on debian wheezy?

I have seen many blog posts that say, it is enough to do aptitude install sudo su root adduser USERNAME sudo But that only protects aptitude, in other words: aptitude install sendmail will ask ...
2
votes
2answers
52 views

What alternative backends does sudo support and how is it configured?

When preparing for the Red Hat Certified Engineer certification examination, I came across this quote in my study notes about the sudo command. By default, the policy is maintained as a flat text ...
1
vote
3answers
92 views

Is there any way to disable shutdowning remote machine?

I sometimes mistakenly shutdown the remote machine by using sudo init 0, so I wrote something like in one of my rc files: alias sudo='sudo ' if [ $SSH_CLIENT ]; then alias init 'echo Never use init ...
2
votes
1answer
562 views

Why does this Bash NRPE plugin not return a variable to Nagios?

This is a very specific question I have here, maybe one has a simple answer for it. This script I have here works locally just fine: #! /bin/bash volts=`sudo vcgencmd measure_volts core|sed ...
1
vote
1answer
51 views

HGRCPATH kept in /etc/sudoers, yet ignored by hg?

I'm trying to follow the directions here under "sudo and multiple users". I believe I managed to modify /etc/sudoers correctly enough (by adding Defaults :me env_keep += "HGRCPATH" at the beginning ...
1
vote
1answer
62 views

Losing (realtime) permission when sudoing from root to myself

After an upgrade to debian wheezy (I did not upgrade the kernel - it is still 3.8.2) I can no longer start jackd in the way I used to do it. I get you are not allowed to use realtime scheduling. My ...
0
votes
1answer
168 views

Webmin administrative panel options are missing

When I log into Webmin, with the Ubuntu administrative user frank, I cannot see most of the administrative options: frank is shown as the Administration username in Webmin. I accidentally ...
1
vote
3answers
91 views

Confused on user and su in linux

How could I run a script as a specific user (non-root)? As this? sudo su - john /usr/share/script.pl for user john?
0
votes
1answer
67 views

rsnapshot LVM without root

I'd like to cron a local backup to a locally mounted USB drive. I'm using rsnapshot and want it to back up an LVM snapshot onto the USB drive. But, unless I run the cron as root it complains that I ...
2
votes
1answer
171 views

How do I grant someone else access to my linux server

If you administer a Linux server, what steps do you take to properly grant someone else access? Assuming they will log in over ssh, don't already have an account, and will need root access. ...
3
votes
2answers
131 views

insert text in a file using echo command [duplicate]

I am trying to insert some text in a file in the following way sudo echo "abc-abc/abc/abc" >> /etc/portage/make.conf but it give me the error Permission denied although I am using sudo ...
2
votes
1answer
277 views

Poweroff or Reboot as normal User

To run the command poweroff or reboot one needs to be super user. Is there anyway I can run this as a normal user? I just don't want to sudo and enter my password every time I reboot or power off.
4
votes
1answer
145 views

RPM fails to uninstall using sudo rpm -e

I have encountered a strange and annoying problem when trying to uninstall certain in-house generated rpm packages using sudo. When I do the following: sudo rpm -e mypackage rpm -qa | grep ...
11
votes
1answer
448 views

How can I `alias sudo !!`?

I'm trying to set an alias for sudo !! in Bash. I tried alias sbb='sudo !!', but it interprets that as a literal !! and prints sudo: !!: command not found If I use double quotes, it substitutes ...
0
votes
1answer
105 views

Are there any Linux distros that protect against “self-mutilation”? [closed]

Over the past week I have installed and reinstalled Linux several times (Mint 15 in all but one case; Ubuntu 13.04 is too slow on my laptop), and after a mishap with QT today I completely gave up in ...
0
votes
1answer
121 views

Execute remote programs and completely detaching it

I need to execute a remote application (named ConnectionManager), which uses the ncurses library, on the remote server launching it from a local pc. ConnectionManager is a program wich use ncurses ...
7
votes
3answers
377 views

Uncover sudoer user with root privileges which ran command X?

I'm the main sysadmin of a system. In the system there are 3 sudoers users with root's privileges. The system runs a script in background which check the hash of system's utilities to detect possible ...
2
votes
1answer
423 views

sudo hangs when run on remote host over ssh in a script without tty (-t)

I have an AIX 6.1 server where I need to run a remote sudo command in a bash script. Here is my bash script simplified: testSudo.sh #!/usr/bin/bash set -x sudo env I can run the sudo command ...
1
vote
2answers
106 views

Staggering the authentication delay on failed `su` or `sudo` [duplicate]

I'm about to start my new job as a sysadmin and I've been thinking about implementing a cooldown feature on su or sudo. The cooldown prevents the user from using these commands for a few seconds after ...
2
votes
2answers
346 views

How to make `sudo` preserve $PATH?

I need to run a program installed on /opt/godi/sbin (a custom directory). If I add that directory to my PATH, by adding the following line to my .bashrc file export ...
0
votes
0answers
94 views

CentOS custom livecd using su throws: “Error setting value: Failed to contact configuration server…”

I am building my own custom CentOS Live CD with tools and settings I need. But if I want to root myself using "su" I always get this error message: Error setting value: Failed to contact ...
2
votes
2answers
3k views

Run a sudo (or startup) python script from cron on a Raspberry Pi?

I'm helping out with an art project (http://stargateeggbeater.com/ for those interested) built on Raspberry Pi. The RPi controls an addressable LED strip through the GPIO, using the spidev device per ...
2
votes
2answers
944 views

How can I mimic `sudo su - user` in a script?

I need to deploy my app to server called lovelyplace by a Fabric script. Unfortunately, the server's setup is horrible, but I can do nothing about it - I have to live with it. There is one non-root ...
0
votes
1answer
447 views

Why does NOEXEC not prevent the specified program from running?

I have tried the NOEXEC in my CentOS6.4 I have edited my /etc/sudo.conf file as below : Path noexec /usr/libexec/sudo_noexec.so and /etc/sudoers: ssh ALL=(root) ALL,NOEXEC:/usr/bin/passwd I am ...
0
votes
2answers
112 views

How can I run a linux build on an NTFS drive?

I'm running under Ubuntu but using a shared drive which is NTFS formatted. I've got blender sitting in a folder (it's the 2.66RC build with some trivial python customisations.) I'm calling blender ...
2
votes
1answer
1k views

sudo: ulimit: command not found

I was using ubuntu 12.04 ,on which I run ulimit -n ,it is showing 1024, I want to increase my open file limit from 1024 to 65535,so I tried the following command: sudo ulimit -n 65535 but i get the ...
0
votes
2answers
345 views

Ubuntu : unable to copy file to dir created under same credentials

I am Windows 7 remoting to Ubuntu 12.04.2 LTS I am new to Ubuntu ( and *nix in general ) and need to understand how permissions are assigned to newly created dirs. Via Putty ssh session : $bash ...
0
votes
2answers
59 views

Have rights during shell but not in a script (unless I sudo it)

I have a really basic confusion. How does sudo work? I noticed that when I ran a script it failed, since it tried to write a file in a directory that the following permissions: $ ls -l thedir ...
1
vote
1answer
494 views

use net instread of cdrom. linux, aptitude install

Got debian installed finally but during install I think I choose to use the local media over the internet for packages. needed to do that as was not sure if will try to connect right away (my modem ...
2
votes
3answers
981 views

How to send to background a running process started with sudo?

I have just installed SLC6 (derived from SL6 derived from RHEL6). I can send a running process to the background by hitting Ctrl-Z in the terminal where it was started. However, I can't do it when I ...
1
vote
1answer
54 views

How do I isolate my file system data from another system root?

I have a linux machine(kubuntu 13.04) A my friend asked me give him an account with being able to use sudo. So, I made an account for him and put the account in /etc/group for him to use sudo I don't ...
3
votes
1answer
817 views

Graphically ask for password in a bash script and retain default sudo timeout setting

The sudo -A (SUDO_ASKPASS) option apparently causes sudo to lose the timeout (e.g., timestamp_timeout) setting. I want to use the sudo -A option but I want to retain the default timeout (e.g., 15 ...