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

learn more… | top users | synonyms

0
votes
0answers
7 views

Apache return Forbidden “You don't have permission to access /path on this server”

I have Apache2 installed on Xubuntu and I've called this command: find projects/ -type d -print0 | xargs -0 chmod 770 and now I can't access http://localhost/projects/some_project directories have ...
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
12 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
68 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 ...
35
votes
7answers
27k 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
11 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
65 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
14 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
27 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.
-2
votes
0answers
23 views

Possible to check ability to sudo before sudo'ing? [migrated]

I'm writing a small utility program. I'd like it to attempt to sudo-run something if required. That is: if file permissions don't allow the current user to operate on a particular file (and sudo ...
93
votes
10answers
37k 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
24 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 ...
0
votes
1answer
40 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
20 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
51 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
2answers
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
33 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
23k 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
656 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
49 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
46 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
30 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
63 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
81 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 ...
51
votes
1answer
75k 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
68 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
22 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 ...
4
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
120 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
29 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
20 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
35 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
37 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
78 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 ...
61
votes
5answers
14k 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
531 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
97 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
34 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 ...
-3
votes
3answers
73 views

I want a user to run bash scripts with sudo [closed]

So this is for a school assignment. I have a working Bind9 and Apache2 server. I've written 3 scripts that make appropriate changes to the configuration files DNS add zone DNS add record HTTP add ...
0
votes
3answers
3k views

Root users and mysql: `sudo mysql` vs `/root/.my.cnf`

I have a /root/.my.cnf file which stores the mysql root user's password: [client] password = "my password" When I log in as system root and enter mysql, I get a passwordless login: myuser@local:$ ...
0
votes
1answer
217 views

Sudo-io log output shows garbled text

We have set up in our servers sudoers config the following configuration in order to log the console output for auditing purposes Defaults:%administrators log_output Defaults logfile=/var/log/sudo ...