sudo is a tool which allows users to run commands as another user (usually the root user)

learn more… | top users | synonyms

0
votes
3answers
4k views

sudo does not prompt for password and reports 3 incorrect password attempts

User smithj is listed in the /etc/sudoers file: root ALL=(ALL) ALL smithj ALL=(ALL) ALL smithj logs into the system via putty. He attempts to sudo but gets this: sudo adduser jonesjp Sorry, try ...
0
votes
1answer
23 views

CentOS 7 Virsh - Allow Non Sudo Users to Interface with QEMU / KVM / Virtual Machines

Is there a way to allow non sudo users access to KVM QEMU virtual machines in CentOS 7? I want to allow a non-root user to manage KVM guest virtual machines without having sudo access. Mainly, I'd ...
0
votes
1answer
2k views

Ansible shell command fails under sudo when it should succeed

I have an Ansible task based on https://github.com/al3x/sovereign/blob/master/roles/tarsnap/tasks/tarsnap.yml#L2 that keeps failing when it should succeed. I used to run the role with ...
0
votes
0answers
17 views

Ansible-galaxy not working with sudo

I'm having problems instaling plugins with ansible-galaxy. I've tried 3 things: Instaling without sudo: ansible-galaxy install sfromm.epel [WARNING]: - sfromm.epel was NOT installed successfully: ...
28
votes
15answers
38k views

Why does sudo command take long to execute?

I've been picking up Linux (Fedora 10, then 11) over the past few months (and enjoying it immensely-- it's like discovering computers all over again, so many things to learn). I've added my user to ...
0
votes
1answer
20 views

How can I ensure auditability and least privilege based on AWS users inside an EC2 image?

I'm interning at a company which runs in an AWS environment and is starting to look into locking down user privileges, so I'm looking into ways to secure EC2 instances. Specifically, I want to find a ...
0
votes
2answers
57 views

Access /proc/$pid/exe as regular user

I am in the process of developing a custom Nagios plugin to monitor the absolute path of a few running processes. As a root user I have always used the command 'ls -l /proc/$pid/exe to find the path ...
1
vote
1answer
2k views

winbind separator and group name behavior in getent group, constantly changing

I have a problem that occasionally apprears-dissapears and it drives me nuts. My Debian servers are authenticated against AD and only "linuxadmins" group member can SSH to server and "sudo su". SSH ...
20
votes
8answers
14k views

Why do I not have syntax highlighting when I sudo vi <filename>?

I don't understand how to allow syntax highlighting in files I'm editing via vi when using sudo. When I 'sudo vi ' the terminal is only black & white of my terminal settings. In vi if I enter ...
0
votes
0answers
13 views

Composer works as Common User but not root

When I run 'composer' as a common user, composer runs just fine. However if I run 'sudo composer' I receive a command not found message. When I enter 'sudo /usr/local/bin/composer' it works just fine. ...
3
votes
2answers
84 views

Allowing PHP to run specific bash script with root permissions

I have a php script calling a bash script like this: <?php $result = exec('sudo /bin/bash /var/www/my_bash_script.sh /var/www/vhosts/testsite/htdocs/'); var_dump($result); ?> This is ...
36
votes
7answers
28k views

Log all commands run by admins on production servers

It is company policy for admins to login to the servers via a personal username, and then run sudo -i to become root. Upon running sudo -i, sudo will create an environmental variable called ...
0
votes
1answer
22 views

How to register user on ejabberd using php code?

I am trying to register user on ejabberd linux server. I am using below php code <?php $username = 'hello'; $password = 'hello'; $node = 'my ip'; exec('sudo -S ejabberd ...
1
vote
1answer
76 views

Sensu executing script sudo a password is required

I have a sensu handler that gets triggered on an endpoint Linux box (Centos 6.6. Here is the script I'm using: #!/bin/bash --login sudo -n -u deploy bash --login -c "cd /var/www/vhosts/sc/current; ...
1
vote
1answer
18 views

Centos 6 - Allow sudo composer self-update for user without password

I'm trying to allow my wheel group user to run sudo composer self-update without a prompt for a password for my deploy script. I have added the bottom line below to my /etc/sudoers file: ## Allows ...
2
votes
1answer
31 views

bash: /etc/hosts: Permission denied [duplicate]

Why when I run I get the error: $ sudo echo "127.0.0.1 db-local.internal" >> /etc/hosts bash: /etc/hosts: Permission denied But when I do sudo su I can edit this file without any problem.
93
votes
10answers
38k views

ssh-agent forwarding and sudo to another user

If I have a server A into which I can login with my ssh key and I have the ability to "sudo su - otheruser", I lose key forwarding, because the env variables are removed and the socket is only ...
-1
votes
1answer
66 views

Setting up SSH with the correct user rights [closed]

I want to setup my SSH connection correctly. As many tutorials told me, it is not recommended to use the root account of Ubuntu server. So I would rather use my standard account "Simon" to upload ...
0
votes
2answers
30 views

Sudo command refused (htpasswd) - CentOS / Apache (htaccess)

I want to give one of the web developers testuser permission to set his own .htpasswd password using the /usr/bin/htpasswd command on the web server 'mywebserver'. The web server tree belongs to the ...
1
vote
1answer
22 views

Running npm via sudo (not as root, not as self-user) can't find npm where root or self-user can

I have a makefile, which I use to sudo make install for the parts of my app that generally require root installation. Unfortunately, this results in a strange situation where sudo doesn't have access ...
0
votes
0answers
57 views

remote execution of commands using sudo /usr/bin/ssh

I have the following sudoers file in /etc/sudoers.d: Cmnd_Alias GETCONFIGFILES = /usr/bin/ssh servername.mydomain.com -p 1022 'cat /path/textfile.txt' User_Alias TOMCATUSER1 = localuser TOMCATUSER1 ...
0
votes
1answer
36 views

Restricting su command in a specific manner

I have a list of system users who have access to almost everything via sudo. Now I would like to restrict their sudo access for command su. I would like to restrict su command for every user on ...
1
vote
0answers
12 views

sudo as another user that contains current user string in username

Let's say there are 100 users in the system: msmith bdole agrant . . . Is there a way to write a generic sudoers rule to allow each of these users to execute commands as another user, where the ...
4
votes
3answers
24k views

nagios nrpe unable to read output

I'm trying to use check_nrpe to check on a remote server, but it's not working and I can't figure out what am I missing... # /usr/lib/nagios/plugins/check_nrpe -H XXX -c check_load -a 6,5,4 8,7,6 ...
0
votes
0answers
18 views

Run a script if another process was spotted

I have CentOS 7 and looking for a sollution about a small issue. I want to have a sudo script to be run but only if the system executed a specific command remotely. For example: I've put my command ...
1
vote
1answer
679 views

Ansible SSH as one user and Sudo as another

I am having trouble with configuring Ansible and sudo to allow me to SSH into a server and run a command as another user. I have gone through the questions / answers below and the Ansible ...
4
votes
1answer
3k views

How do I “sudo -i” specific command

I need to run important_script.sh as with sudo -i without password. If I have in sudoers: apache ALL = (root) NOPASSWD: /blah/important_script.sh and run "sudo /blah/important_script.sh" I can ...
2
votes
1answer
60 views

use Sudo in apache

I am using CentOS 6 and trying to call sudo in Apache using this command: exec("sudo -u kouser whoami 2>&1",$output,$code); However SElinux add a line to output array(2) { [0]=> ...
1
vote
2answers
47 views

Recursive Sudo Privileges

I am in the process of setting up specialized sudo for our first line support team. I would like to authorized them to delete anything within /var/log/. The command below however only applies to files ...
0
votes
1answer
35 views

SUDO command only works as root (Solaris 10)

After installing sudo in the system i am unable tu run sudo as a non-root user, when i try to execute any command i get: /usr/local/bin/sudo: cannot execute if i edit /etc/passwd to use a different ...
0
votes
2answers
69 views

Using GREP to Find Text in Files

I'm trying to use grep to find a specific line of PHP code I know for certain is present in several files, but all I get back is an empty result. Please advise on how I need to modify my grep query: ...
1
vote
1answer
103 views

Difference between sudo /bin/bash and sudo su to access root

I am aware that there are at least 2 ways to escalate to root privileges when in the terminal, and am genuinely curious as to whether there is a differences / are differences as to what can be ...
1
vote
2answers
186 views

Use sudo in shell script

I have access to another user's account using command: sudo su - other_user I do not have enter password. It seems that this is the only command that sudo allows me. After that I'm able to perform ...
52
votes
1answer
76k views

sudoers: how to disable requiretty per user

I don't want to uncomment the line in /etc/sudoers: Defaults requiretty Instead, I only want a certain user not to require a tty. How can this be done?
2
votes
2answers
4k views

What to change in /etc/sudoers to allow restarting service?

I want an unprivileged user to be able to restart tomcat on my server. So I edited /etc/sudoers as follows username ALL=/etc/init.d/tomcat6 However, when the user runs /etc/init.d/tomcat6 restart ...
2
votes
2answers
75 views

Linux: Allow user to execute specific command on behalf of any other user

I am trying to find a way to allow user john to execute a command (say echo) on behalf of another user peter without being prompted for password. I found a thread that I thought would be the answer ...
1
vote
2answers
27 views

Prevent root in linux from changing folder permissions in GPFS filessystem

I have created a NFS export in a GPFS/SpectrumScale filesystem I created. I have enabled AD based authentication with our domain. Everything works. The NFS export was created with NFS4. The NFS ...
1
vote
1answer
23 views

Unable to mount NFS export unless I sudo to root

I created an NFS export on a GPFS/SpectrumScale filesystem I set up. I tested the NFS export on a xLinux, pLinux, z/OS and AIX succesfully. I then enabled AD based authentication on the NFS export ...
5
votes
4answers
5k views

check admin rights inside python script

How to check that my python script is running under Administrator rights (sudo) under BSD-like OS? Need to display user-friendly warning in order it is executed without admin rights.
0
votes
1answer
169 views

sudo and Kerberos on AWS Linux issues

We have an issue on some of our AWS machines, running Amazon's hacked Fedora/RHEL linux where newer-in-AD users can login with password but cannot autheticate for sudo. Users that were created in AD ...
0
votes
0answers
47 views

How to autostart node forever and spawn() as sudo?

My app periodically spawns a CasperJS scraper: spawn(CASPER_PATH, [SCRIPTS_PATH + fileName, '--ssl-protocol=any', '--user='+user, '--scrapeId='+scrapeId, '--pass='+pass], { ...
1
vote
0answers
22 views

How to run root commands form a website? [closed]

Im working on a project, in it I intend to make a website with server administartion functionalities. So far, I'm able to run all guest commands like ping,nmap,etc. But, I want to run root commands as ...
2
votes
1answer
37 views

Create a Web User

I am running Apache 2.4.8 on Arch Linux, but that doesn't matter really. I would like to create a user who is devoted to web management. I have created a user, a group, and added the user to the ...
-2
votes
1answer
41 views

Is it possible to “sudo su” using ssh in bash? [duplicate]

#!/bin/bash USERNAME=ksmith HOSTS="linux1" YUPDATE="sudo yum -y update" FIXDATE="sudo -u echo -e 'ZONE="America/New_York"\nUTC=true' > /etc/sysconfig/clock" for HOSTNAME in ${HOSTS} ; do ssh -tt ...
0
votes
0answers
102 views

sudo NFS SUID not working

Today I decided to move my NFS files from an ext4 HDD to an ext2 HDD using mc. Since then I am having trouble running the sudo command on all clients. When I try to run it I get an error saying ...
62
votes
5answers
15k views

How can I implement ansible with per-host passwords, securely?

I would like to use ansible to manage a group of existing servers. I have created an ansible_hosts file, and tested successfully (with the -K option) with commands that only target a single host ...
0
votes
1answer
868 views

sudo mv fails with “Operation not permitted”

When I command on my MacOS: > sudo mv /usr/bin/php /usr/bin/php-52 I get the result: mv: rename /usr/bin/php to /usr/bin/php-52: Operation not permitted What can I do? Thanks!
5
votes
1answer
104 views

Limit number of concurrent users switching to root account?

This is for Ubuntu 14.04 and Centos 7. I need to limit the number of users actively running as root. i.e. Logged in as root on the CLI. Basically, I want only one user at a time to be able to run ...
0
votes
0answers
43 views

cann't we have 32 bit uuid package installed along with 64 bit uuid package in ubuntu 12.04 64 bit

i am using 64 bit Ubuntu 12.04. i am trying to build 32 bit project in 64 bit Ubuntu OS. UUID generator related functions in a library. it is giving below linker error related to luuid: ...
1
vote
3answers
264 views

su to user that doesn't exist any longer?

I have an interesting situation, where a user's account has been temporarily removed (paperwork not renewed in time). However, thanks to the magic of "screen", his processes are still running. I ...