sudo - Execute a command with superuser privileges.

learn more… | top users | synonyms

0
votes
1answer
17 views

Edited sudoers, but the user can not run sudo command

A user has been added with root access in the /etc/sudoers but, it seems that it can not run sudo commands. [root@compute-0-0 ~]# cat /etc/sudoers root ALL=(ALL) ALL hduser ALL=(ALL) ...
1
vote
1answer
16 views

login with apache user

I'm following this tutorial step by step,for Here we clone the repo into a chmodded /var/www/[site_dir] folder. Note that we switch to the www-data user before running the git clone command. ...
3
votes
1answer
17 views

Get iSerial with lsusb without sudo

Under my sudoer user (non-root), I can see my device with lsusb. However, to see the iSerial number, I need to issue lsusb -v, I do get a lot of information printed, but the message "Couldn't open ...
14
votes
5answers
3k views

How does the OS know that a command needs sudo?

When you run an executable, sometimes the OS will deny your permission to. For example running make install with the prefix being a system path will need sudo, while with the prefix being a non-...
6
votes
7answers
346 views

How to secure a sudo - powered script

Solution for executing root commands as unprivileged user - sudo 'ing script - easily opens possibility of security breach and unexpected behavior and results (this is also true for any other solution ...
1
vote
1answer
25 views

Why would root need to run unrestricted commands as itself via doas?

I've just come across doas, and while reading the man page for its configuration I found this example: The following example permits users in group wsrc to build ports; wheel to execute commands ...
1
vote
0answers
40 views

Why can't I install bc on my Raspberry Pi? [duplicate]

When I try to run the command sudo apt-get install bc I get the following error message: Reading package lists... Done Building dependency tree Reading state information... Done Package munin-...
1
vote
1answer
28 views

What do I need to have inside of my sources.list file?

I can't download a thing. When I run sudo apt-get for any program I get the error Package [insert name here] has no installation candidate. I've looked online and there are hundreds of ...
0
votes
1answer
162 views

Sudo Apache, with command line ? (not visudo)

I have visudo-edited /etc/sudoers this way: User_Alias APACHE = www-data Cmnd_Alias FIREWALL = /sbin/iptables, /sbin/ifconfig, /sbin/route APACHE ALL = (ALL) NOPASSWD: FIREWALL (To allow php ...
3
votes
2answers
1k views

Sudo email notification setup error

I'm Using Centos version: [sysadmin@backup-srv ~]$ cat /etc/redhat-release CentOS release 6.4 (Final) I'm using this sudo version: [sysadmin@backup-srv ~]$ sudo -V Sudo version 1.8.6p3 Sudoers ...
1
vote
1answer
40 views

Su as root and run command in one line

I need to su as root and run a command as a single line. This is for use in a python script. What I am looking for is: $ su root [some-magic] sh /home/jay/script-that-needs-executing-as-root.sh <...
0
votes
0answers
22 views

How to create a sudo user in linux? [duplicate]

I want to add a sudo user in my account but whenever I try to intall ssh connection, it shows user not in the sudoers file. How do I proceed ? I created my user using this- sudo useradd -m username ...
6
votes
1answer
88 views

How does sudo work (besides setuid)?

sudo is elevated to root upon launch because it's binary has a setuid enabled. But when I give /bin/login the exact privileges sudo has, and I try to run it from a user that isn't root, I get the ...
3
votes
2answers
4k views

How to allow www-data to create a folder without giving read access to the parent folder

I'm not exactly sure the right question to ask, so I'll try to explain what I'm trying to do. I have an internal web application (in PHP) that I want to be able to create a folder. The trouble is ...
8
votes
3answers
12k views

how to pass environment variable to sudo su

I basically need to do this: DUMMY=dummy sudo su - ec2-user -c 'echo $DUMMY' This doesnt work. How can I pass the env variable $DUMMY to su? -p doesnt work with -l.
2
votes
1answer
1k views

How do I get simple scripts which seem to need root priveliges to run via the www-data user?

I am programming a small web interface to control samba on Debian (kernel 2.6.32-5-686). I started by writing simple scripts to add users, create folders, etc. They worked fine when run as root. ...
-1
votes
2answers
33 views

Privilegies of command inside shell script

I need to run simple script to check host status (ping), I have following script: #!/bin/bash echo "Host checker:" if [ "`ping -c 1 172.17.10.1`" ] then echo "HOST UP" else echo "HOST DOWN" fi ...
1
vote
3answers
10k views

Enable ssh root login

I have access to a CentOS server with a user that its not root but belongs to the sudoers list. I do not have the password of root, nor I can't find out what it is (policies of the people who gave me ...
5
votes
1answer
592 views

How to enable `sudo` with custom functions?

Recently I learned you can enable sudo for custom aliases as follows: alias sudo='sudo ' # note: the space is required! The reason this works is the following: If the last character of the ...
0
votes
1answer
102 views

Running SSH command from PHP gives sudo: no tty present and no askpass program specified error even though NOPASSWD settings are done

I am using LAMPP to run apache server. From a php file I am executing a python script which executes ssh, scp commands. But I am getting error: sudo: no tty present and no askpass program specified ...
1
vote
2answers
39 views

Use root privilege without password

I am on Debian 8 and I am searching for a command in debian to use root privilege without password. I am asking because I already saw it somewhere but can't find it anymore.
0
votes
1answer
32 views

alias pip to sudo pip

When using pip I almost always use sudo because otherwise it lacks permissions. I plan on adding an alias pip="sudo pip" in my .zshrc file. Is there a reason I shouldn't do that? The main issue I can ...
1
vote
1answer
26 views

How can I make sudo discard all environment variables? [duplicate]

People usually want to preserve their environment variables while executing sudo for various reasons, but, there are some cases where discarding environment variables makes much more sense. For ...
35
votes
5answers
11k 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 ...
3
votes
1answer
208 views

How do I access a folder which I can't sudo cd into?

I'm trying to change my directory to /boot/efi, but running sudo cd /boot/efi does nothing. I'm on fedora 23. Is there a more powerful command for this?
1
vote
1answer
42 views

Which PATH does `sudo <command>` use to search for `<command>`?

I installed eclipse in my home directory, and put its path in PATH in ~/.profile. So it works by $ eclipse But when call it with sudo, eclipse isn't found: $ sudo eclipse sudo: eclipse: command ...
7
votes
3answers
314 views

How to harden su with dpkg-statoverride?

I am reading an Ubuntu 14 hardening guide and this is one of the suggestions: It generally seems like a sensible idea to make sure that only users in the sudo group are able to run the su ...
15
votes
7answers
159k views

Username is not in the sudoers file. This incident will be reported

I am running Ubuntu 12.04 on my laptop using VMware Player. I am not sure why but I have an account called "User Account" in addition to my account that I usually login to use Ubuntu. Well that was ...
4
votes
1answer
104 views

Sudoers: Allow any subcommand for certain argument

I'm trying to allow a group of users to gain some control over an instance of a dhcpcd service. In other words I would like to have them be able to run: systemctl (start,stop,...) dhcpcd@eth0.service ...
30
votes
2answers
32k views

Why is sudo not installed by default in Debian?

I was reading a guide to install some software and came reading until this shocking statement: sudo is not installed on Debian by default. Make sure your system is up-to-date and install it. As ...
3
votes
1answer
955 views

sudo -u git clone

I'm on Ubuntu server 14.04. I am using apache web server which runs as the www-data. I need to do git clone from a script (a web hook). This script will run with www-data user privilages. Running ...
-1
votes
0answers
70 views

What is the difference between “sudo su -” and “sudo su -l”?

On Xubuntu 14.04, looking at the man pages, su - and su -l should be the same. -, -l, --login Provide an environment similar to what the user would expect had the user logged in directly. I ...
0
votes
0answers
32 views

How to fix system after wrong permissions? [duplicate]

I changed permissions on / by mistake using chmod -R 755 /* instead of ./* after doing sudo -s. I stopped the process in the middle of it after realizing what was going on. But it was too late. Now ...
1
vote
1answer
44 views

Sudo, no access to user files

I installed the newest version of Debian and have no access to my own files when using the sudo command: ls -> shows files in my home directory sudo ls -> permission denied My user is part of ...
0
votes
1answer
25 views

How to give a particular use's privileges to another user in Debian?

Lets say in my Debian PC have 2 users called cat and dog. I want to use sudo setup to give dog's privileges to cat. So cat can do what dogs do. I'm new to sudo stuff but I tried below config. It ...
0
votes
1answer
101 views

Difference between sudo user and root user [closed]

The /etc/sudoers file lists which users can do what with the sudo command The root user creates and modifies the /etc/sudoers file. This concept is difficult for me to understand. If all users ...
1
vote
1answer
26 views

No sudo after using `visudo -x` option

visudo warned me about syntax errors so I exited without making changes. I decided to create a new file within /etc/sudoers.d instead. Unfortunately, I didn't pay quite enough attention to the manfile ...
0
votes
2answers
55 views

Linux Debian Jessie sudo command keeps asking for password

I have recently configured a Symfony 3 site which involved me to set up some permissions on the /var folder. I had to do the following: $ HTTPDUSER=`ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]...
0
votes
1answer
29 views

Echo while waiting for sudo prompt

Context I am using this way of elevating permissions in a script if not run as a root. My Bash script checks for the presence of a certain file it needs to use: if [ $EUID != 0 ]; then if [ -f "...
7
votes
3answers
613 views

Can vim edit a remote file as root?

I've found this question that explains how to edit a remote file with vim using: vim scp://user@myserver[:port]//path/to/file.txt Is it possible to do this as root (via sudo) on the remote host? ...
0
votes
1answer
35 views

adding a sudoer in debian

After a long search on the web, trying everything I can find I came to ask you guys, how can I add an existing user to be a sudoer? I've tried usermod -a -G sudo user and also adduser user ...
1
vote
0answers
57 views

How to send sudo password over pipe? [duplicate]

I need to replace existing sshd config on the remote PC and restart sshd, so I try to use this: cat /sshd_cfg | ssh user@192.168.0.47 "cat > /etc/ssh/sshd_config && service sshd restart" ...
1
vote
2answers
70 views

`sudo: command not found' when following a tutorial for Let's Encrypt

I'm following a Godaddy help tutorial in order to install Let's Encrypt certificate for my website. So I connected to my server using ssh via Putty. Typing the command sudo git clone https://github....
7
votes
1answer
5k views

How do I allow non-root users to control a systemd service with instances?

I need to allow users in the dba group to control the database@ services. The answer to this related question is to just list all systemctl "verbs" that I want to allow in the sudoers file, however, ...
3
votes
3answers
3k views

I accidentally deleted the sudoers file on Mac OS X; is there any way to recover it?

I accidentalley deleted the sudoers file on Mac OS X; is there any way to recover it? And once you've recovered it, how do you set it to mode 0440? I presume not but I am desperate to get it back!
3
votes
1answer
41 views

Questions about sudo

I have a couple of questions on using sudo: Give Ben sudo access to the machine Give Tim sudo access to the following tool : iptables For (1) I just address Ben to the sudo group. So I did: ...
2
votes
1answer
53 views

using sudoers to allow non-privileged user to restart apache

We have production centos servers that run apache as root to allow low port numbers (80 and 443). We'd like a secure way for non-root users to restart apache. Are there any security implications ...
2
votes
0answers
27 views

How to allow traceroute to run as root on ubuntu

I'm trying to programatically call traceroute on Ubuntu but i'm getting blocked when trying to use the -I or -T flags for ICMP/TCP packets. Accroding to this question I can use the terminal command ...
0
votes
1answer
2k 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 ...
0
votes
2answers
79 views

mussh no tty present and no askpass program specified

Using MUSSH on remote machine to execute a bash script $ mussh -a -i ~/.ssh/id_rsa -d -H mas-hostfile -c 'bash script.sh' -m2 sudo: unable to resolve host hostname aurelien@000.000.000: sudo: no tty ...