Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [sudo]

sudo - Execute a command with superuser privileges.

0
votes
0answers
25 views

switching to another user gives an error [duplicate]

I am logged into one machine as user "john" and now if I try to switch to another user "dummy", I am getting below error. Long time back I only created this "dummy" user but forgot how I did that: ...
-1
votes
0answers
20 views

Root login in Debian 4 [duplicate]

I have old Debian 4 laptop. I can login with username and password, but looks like my user is not power user. I can't login to system with root user since I don't remember it's password. Is it ...
0
votes
0answers
45 views

sudo is accepting everything as password except the correct password! [closed]

On my elementaryOS juno, I'd installed fingerprint-gui and fprint-demo to set fingerprint unlock to my laptop, but unfortunately I couldn't get it to work, so I removed both fprint-demo and ...
0
votes
0answers
26 views

sudoers line for sudo user with /bin/su command or runas or /bin/bash

What is the difference between these three sudoers line and which one is more secure and auditable? End goal is anyone in the group 'sudogroup' group should be able to sudo to user 'swuser' or run as '...
-2
votes
0answers
28 views

sshfs as root on a remote host by connecting first as normal user in debian 9

I have a machine where the root access isn't directly available via ssh. When I have to administer my machine I connect to it via myuser account: ssh myuser@remotehost then I switch to the root ...
0
votes
2answers
32 views

Does sudo restrict on which users can acquire superuser privileges?

The password which sudo asks for is the invoking user's password. So a user can have superuser prilleges as long as it remembers its own password, which seem very easy for any user. So does sudo ...
1
vote
1answer
37 views

Running an executable without sudo

I have a small function in my .zshrc. It creates a command to search for and run an executable file, that may or may not exist, in the current directory, or a parent directory somewhere up the current ...
-5
votes
3answers
51 views

Why is sudo's version worth protection?

I am surprised to see $ sudo -v [sudo] password for t: Why is its version worth protection? Thanks.
0
votes
2answers
34 views

How would you put a job which requires sudo to background?

I am looking for a way of putting a job which requires sudo to background, with as little interaction as possible except maybe typing my password. sudo requires password from terminal, while ...
0
votes
1answer
50 views

How to add a new user and disable its root login? [closed]

A sysadmin may want to add a new user that will have no root access (nor sudo). I don't sell hosting services but I can bring this field as an example; an hosting company gives its customers the ...
9
votes
2answers
384 views

shell script: use sudo inside it vs run it with sudo?

When writing a shell script, in which some but not all commands in it need superuser privileges, shall I add sudo to those commands which need superuser privileges, and run the shell script without ...
1
vote
1answer
31 views

Why does this script keep running after receiving SIGINT?

I learned from https://unix.stackexchange.com/a/230568/674 thatping will exit with 0 after receiving SIGINT, which allows a bash script containing a ping command to continue running instead of exiting....
0
votes
1answer
28 views

Why does sudo accept password not from stdin by default?

I learned from my earlier question What's the purpose of using `sudo -S` explicitly? that sudo accepts password not from stdin by default. Why is that? Is it because of some security reason?
-1
votes
0answers
42 views

How does one use Askpass programs with sudo?

sudo has this option called sudo -A, but I cannot figure out how to use that flag. I'd like to incorporate this sudo -A command into my mounting script.
1
vote
2answers
58 views

How may I provide my password repeatedly to a script contaning a loop of sudo?

I have a script which contains while true sudo mycmd sleep 10000 [ ... ] ; break end when I run the script in bash, I will have to provide my password once in 10000 seconds after finishing ...
1
vote
1answer
40 views

Are cron tasks in `/etc/cron.d/` files supposed to not contain `sudo`?

In /etc/cron.d/myjob, I create a cron task of running a bash script and redirect its stdout and stderr to a log file. The script contains a line of sudo running a command. In the log file: sudo: no ...
0
votes
1answer
20 views

How can I open a shell in the environment that cron (alternatively launchd) uses to execute commands?

I am trying to get launchd (which is macOS's alternative for cron) to run a job for me. It doesn't work, while running the commands on a bash launched with sudo does. I tried redirecting the output to ...
1
vote
1answer
46 views

VISUDO: passwordless sudo does not work for user

I've altered my /etc/sudoers file with sudo visudo as follows (showing only uncommented lines, the entire file can be found here): $ grep -v '^#[^i]' /etc/sudoers/ | grep . root ALL=(ALL) ALL %wheel ...
1
vote
1answer
28 views

sudo error unable to resolve host locahost (using linuxdeploy on android device)

So I installed linuxdeploy on my phone to mess around with a debian linux. Installed debian 9 for arm64 and so far so good. Only when I run any "sudo" command, I'm getting the following warning: ...
0
votes
1answer
27 views

Calling sync without root privileges

I can call sync without root privileges. Does it flush all buffers to disk? Is it the same as calling it with root privileges like sudo sync?
0
votes
1answer
42 views

sudoers - allow user to ssh as another user and run a specific command

I am writing a Bash script to manage various JBoss instances across multiple servers. The script allows users to check the status of each instance as well as stop/start them. The script is situated ...
1
vote
1answer
31 views

sudo -su vs sudo su -

On RHEL 7.5, I created a non-root user and would like to switch from one non-root-user to another non-root-user, without password. First tried, sudo -u user1, command syntax error then tried, sudo ...
0
votes
1answer
62 views

How a non-root user sudo to another non-root user without password?

As root, created a new non-root user on RHEL 7.5 appuser:x:1903:1903:appuser:/home/appuser:/bin/bash A non-root user to be able to sudo to appuser, sudo -u appuser without a password, What are ...
-1
votes
1answer
12 views

systemctl zabbix invoke sudo shell command in python scrip

two days ago,I change my running of zabbix-agent from zabbix_agentd run directly to systemctl start zabbix-agent.There is a weired thing.I write a python script to monitor java GC status, which invoke ...
0
votes
0answers
39 views

/bin/sleep not working in systemd service commandline

I have a kiosk-like Linux box (Debian stretch with Gnome) that runs just one specific application. This application was launched by a .desktop file in .config/autostart in the home directory of the ...
2
votes
2answers
27 views

Adding a user to sudo group vs creating a sudoers file

What is the practical difference between: adding a user to sudo (Debian) or wheel (RHEL) group sudo usermod -aG sudo/wheel <username> vs creating a file named username with the following ...
0
votes
1answer
24 views

How to Resolve `permission denied` on Cloned Image

I had a Linux image on an Orange Pi that was had access to the GPIO pins via the command line sudo echo 1 > /sys/class/gpio_sw/PA1/data. I took the SD card out and put it into another Orange Pi ...
0
votes
0answers
94 views

while increasing ulimit forming error:- “bash: ulimit: open files: cannot modify limit: Operation not permitted”

I'm increasing the ulimit in ubuntu using command ulimit -n 10000 but it gives me error of bash: ulimit: open files: cannot modify limit: Operation not permitted I search for this error. This question ...
2
votes
1answer
49 views

Time range option in shutdown for a user in sudoers

I need to give sudo privileges to a user for shutdown permissions. But the user can only send out a shutdown request with a time of greater than 3 hours. I've been trying by implementing globbing. ...
6
votes
2answers
184 views

setting sudo password different from login password

I am attempting to use PAM to use a different password for sudo than I do for logging in. I worked off of this post originally Set sudo password differently from login one Unfortunately, every time ...
0
votes
1answer
20 views

Trouble with executing a bash with sudo privileges

I wrote a script that prompts me in dmenu the availible drives to mount or unmount and I added to the with visudo the following line ALL ALL = NOPASSWD: /path/to/usb-mount and the script basically ...
1
vote
0answers
31 views

GUI for application with and without sudo

I was running wireshark when I realized that executing it using sudo and without sudo gave me a different user interface. When running using sudo, it gives me nice sized icon and text. But running it ...
0
votes
3answers
53 views

Is there a way to protect a file in any way so that other superusers CANNOT modify, delete or overwrite it?

Due to keyword hell I can't find the answer to this question and I'm hoping someone can let me know what the answer is. When entering a sudo command file is there a way to set a parameter(s) which ...
3
votes
3answers
681 views

Sudo: disallow shell escapes as a default

I cannot work out how to disable shell escapes for any command, so that I could (this is an example!) do something like: sudo-user ALL=(ALL) NOEXEC: NOPASSWD: ALL The sudoers manual says this: A ...
0
votes
0answers
20 views

Mount “Visible” to PHP but not to “System”

I have a mount bash script. I can run the script from CL fine. It mounts as expected. I call this same script from PHP using exec() and get no errors. www-data has sudo rights listed for this ...
0
votes
0answers
29 views

Running Commandline Scripts Through PHP

I am having difficulties running bash scripts with php's exec() and wanted to get some suggestions. I would love to be more flexible in this area because I can see a lot of potential for my small ...
2
votes
1answer
38 views

sudoers syntax error after adding a simple comma [duplicate]

Here is my original /etc/sudoers.d/www file: Cmnd_Alias WWWCMDS = /home/xxx/shop/update.sh www-data ALL=(ALL) NOPASSWD: WWWCMDS I simply want to add two additional commands so I RTFM and saw that ...
1
vote
1answer
46 views

sudo not executing bashrc as expected

Overall issue is when I log in, my prompt appears correctly formatted as per the /etc/bashrc but when I sudo to another user using bash, the prompt gets fubar'd. Essential formatting in the /etc/...
0
votes
1answer
33 views

Using 'at' and 'systemctl' commands together

I'm trying to schedule shutdown of PC using at command like this: echo "systemctl poweroff" | at -M now +1 minute or like this: echo "sudo systemctl poweroff" | at -M now +1 minute but nothing ...
-1
votes
2answers
34 views

reestablish root shell

I disabled the shell of user root with the command chuser shell=/bin/false root and now I cannot switch to root with sudo su -. PermitRootLogin is disabled too, so I don’t know how could I reestablish ...
0
votes
1answer
44 views

unable to run command as sudo in php (CentOS 7)

I need to run a sudo command from a PHP script in CentOS 7, but I am getting an error: sudo: no tty present and no askpass program specified I have edited my sudoers file with the following lines,...
1
vote
1answer
891 views

sudo not found and can't be installed

I just installed Debian 9.3.0 and I tried to run command sudo apt-get update but this error came up : sudo: command not found so I turned to superuser and run command apt-get update in superuser ...
0
votes
3answers
81 views

Can not run a sudo script without password?

I'm using arch linux - i3. I have a script to run rmmod hid-multitouch && sudo modprobe hid-multitouch. I edited the hot key in i3 and set an exception to run a script without password using ...
0
votes
1answer
57 views

How to omit PAM log messages for specific user (pam_succeed_if quiet)

I'm using a monitoring agent (telegraf) to monitor fail2ban. Unfortunately, it requires SuperUser rights to execute fail2ban-client, which causes 24 system log messages every 10 seconds... Do the math,...
-1
votes
3answers
94 views

Why does sudo exist? Why not handle privileged system access as a user permission?

Please note: I am not asking "what does sudo do" of which I know the answer. There are plenty of IT systems that have no concept of sudo - instead, each system user is either an "admin user" (...
1
vote
1answer
29 views

How should I grant a user the privilege to restart the nagios services?

What is the best way to grant user an access so they can restart the nagios services? I have added in visudo USER ALL = NOPASSWD: /usr/sbin/service ServiceName * But that did not work, I am using ...
0
votes
0answers
43 views

How to retrieve information of a user?

After running below commands, [root@u87 ~]# getent group somegroup somegroup:*:2441:someuser [root@u87 ~]# [root@u87 ~]# [root@u87 ~]# cat /etc/group | grep somegroup [root@u87 ~]# [root@u87 ~]# cat ...
1
vote
2answers
52 views

Why does ssh look for keys in /root/.ssh when run with sudo?

When I try to sudo ssh ... I get permission denied because ssh looks in /root/.ssh for the keys, not in /home/me/.ssh. But $HOME is still set to /home/me. Why doesn't ssh look in $HOME/.ssh?
0
votes
0answers
17 views

Allow non-privilaged users to start/stop/restart Apache, Bind, MariaDB on CentOS 7.x

Trying to find the best way to let regular users to be able to start, stop, restart and check statuses of some backend servers like Apache, Bind, MariaDB. The accepted answer: %users2 keep ALL=...
2
votes
1answer
63 views

Command not found when run as sudo

I'm running centos7. I installed puppet. if I write puppet as a user, I get a proper output. If I write sudo puppet I get command not found. The really weird thing is, if I do sudo su - and become ...