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.

1
vote
2answers
29 views

Add “domain admins” group in sudo users [duplicate]

I want to give access domain admins group to sudoers access. I have come across with many commands but nun of works for me. fname.lname ALL=(ALL) ALL With this command i can give access to a ...
0
votes
0answers
33 views

Run sudo from non admin account in one command line [on hold]

I'm trying to run a sudo command in a non admin account (An account with no sudo privileges). So far I tried with su, to change to the adm account, but it requires a password after. When I do echo ...
1
vote
0answers
31 views

How to prevent automated message being printed every time I sudo, without changing global settings?

At my office whenever I log into a linux server I get a standard message which basically amounts to "You consent to us monitoring you if you use this machine". This has been required part of every ...
29
votes
1answer
2k views

Given that root has all privileges, why is root ALL=(ALL) ALL in /etc/sudoers? [duplicate]

I looked at this question: Trying to understand the difference between “modernNeo ALL=(ALL:ALL) ALL” and “modernNeo ALL=(ALL) ALL” in the sudoers file I still have a question. Since the "root" user ...
2
votes
2answers
63 views

Why is /etc/sudoers not world-readable?

I'm struggling to think what security risks there could be to knowing who is allowed to use sudo.
2
votes
0answers
33 views

Recovering from chown -R <user> /usr/bin [duplicate]

I ran chown -R <user> /usr/bin in arch thinking I could easily fix it if anything went wrong. Unfortunately, that has proven to be incorrect. As a result of this, startx won't run i3 ...
0
votes
0answers
30 views

Raising permissions of account “dummy” when executing command from “root” as “dummy”?

Context: While trying to execute command su a -c task as user dummy when being logged (with sudo su in as root on Ubuntu 16.04, I receive the following error message: root@DESKTOP-344ab:/home/dummy#...
2
votes
1answer
41 views

Keep access to a file after sudo

user1 runs sudo -u user2 SomeCommand. I want SomeCommand to be able to access the files of user1 (or just a specific directory or even a single file, if that's easier), without giving access to user2 (...
1
vote
1answer
53 views

Sudo installation problems

I just downloaded Debian 9.6.0 from osboxes to run it on a VM. However, I ran into a few problems. I can't sudo. Ok, you have to install it first. No problems... I thought. Turns out, there are a few ...
1
vote
1answer
29 views

Connecting to SSH authentication agent when running commands with sudo

I use etckeeper to keep my various OS configurations under version control. Until now, I was content to just use a local Git repository to keep track of changes but it occurred to me that I wasn’t ...
0
votes
3answers
53 views

How can you write to a file from the command line without using shell output redirection? [duplicate]

I'm trying to: sudo echo "$USER: my message" > /dev/kmsg to write a message to the dmesg log. This causes a 'permission denied' error, because it is redirecting the output of 'sudo' (while no ...
4
votes
2answers
107 views

Linux Mint. How to set the terminal password to be invisible?

I change to Linux Mint about 2 days ago. And I feel uncomfortable when I put the 'sudo password', because I used to see nothing and now I saw "*****".
4
votes
1answer
128 views

Best way to setup sudo authentication on servers that don't use a password?

With sudo, you can either set it to ask for a password or not ask for a password. Historically, everything was password-protected, which is the model that I am used to. However, encryption seems to ...
4
votes
1answer
126 views

Trying to understand the difference between “modernNeo ALL=(ALL:ALL) ALL” and “modernNeo ALL=(ALL) ALL” in the sudoers file

In the sudoers file, you can have either of the following lines modernNeo ALL=(ALL:ALL) ALL modernNeo ALL=(ALL) ALL I looked at the following answers on here to understand this https://askubuntu....
1
vote
1answer
86 views

What is logging in?

From https://unix.stackexchange.com/a/489913/674 Logging in is a user-space construct; the kernel doesn’t care about that. There are multiple examples of this; for example, cron jobs can run ...
2
votes
0answers
101 views

SSH connection getting closed automatically after a sudo command

I have two servers running the same version of RedHat 6.4, however one of them behaves differently when I run remote sudo commands through SSH on it. On server1, the connection is automatically closed ...
-1
votes
0answers
24 views

what is the difference between sudo -s and sudo -i? [duplicate]

From https://stackoverflow.com/posts/53809141 What is the difference between sudo -s and sudo -i? In the book "A practical guide to linux commands, editors and shell programming" by Mark G. Sobell, ...
0
votes
1answer
32 views

Using service account to copy the apps

Currently we are having Git repository which is configured with srvapps (service account).I can sudo to the Git server using this account (username - srvapps and password - my login password). My ...
1
vote
1answer
39 views

sudo emacs doesn't read my elpa packages

Here is my problem on a server running CentOS 7 with emacs 24.3.1.: When I run sudo emacs <protected_file> on a file that I don't have write permissions, emacs doesn't read my .emacs file, nor ...
0
votes
1answer
15 views

using sudo with piped command on Ubuntu server

If I need to use the following backup command on an Ubuntu server with sudo, how do I do so? Do I need sudo at two places? tar cf - directory | 7za a -si directory.tar.7z
-1
votes
0answers
42 views

How to restrict access to terminal

I have a Raspberry Pi running Raspbian graphical desktop which I have locked down to restrict the user to a limited number of applications. Everything has been removed from the menu except these ...
0
votes
1answer
74 views

Installing headless chrome without sudo

I am using Dreamhost VPS which doesn't provide sudo capability. Dreamhost runs on Ubuntu. My final goal is to be able to use Ruby to run headless web browser. I picked Watir gem and it requires ...
0
votes
0answers
32 views

Notepadqq doesn't ask to retry as root, gksu doesn't work

I want to open config files in Notepadqq. When I try to do this normally, I get an error dialog with message "Permission denied" and options Ignore, Abort and Retry. Supposedly if gksu is detected ...
1
vote
1answer
63 views

Gain Root Access to remote Server with sudo, su, and pkexec not working

I'm running CentOS7 on an old dell box that I repurposed as a home server. I also ssh into it from a remote location to make sure everything is running smoothly, and to do things like rsync my laptop. ...
0
votes
2answers
100 views

Accidentally moved sudoers file

I accidentally moved /etc/sudoers to Documents. I need to move it back to /etc, but I can't since I need to be sudo to move files... sudo mv Documents/sudoers /etc sudo: unable to stat /etc/sudoers: ...
1
vote
0answers
35 views

Cutting output from sudo in a bash script

I am writing a script that is supposed to ask for user's password, do some stuff with it and eventually pass it to sudo. This is roughly how it looks: echo "input password: " read -s password printf "...
0
votes
1answer
82 views

Is it possible to get the output of only sudo command?

I want to write the output of only sudo command to some file i.e. the line which I get on terminal after writing sudo i.e. [sudo] password for user: If I use sudo ls > file or sudo ls 2> file ...
0
votes
1answer
208 views

Allowing non root users to manage systemd service is not working

I wanted to allow specific non root users to start/stop certain systemd services in CentOS7. But there has been no luck on the steps that I have tried so far. Here is what I have tried. I have added ...
3
votes
1answer
35 views

“sudo -s <command>” runs command in a shell, but wildcards or metacharacters not working

When using sudo -s (short for the "--shell" option), it is possible to pass "sudo" a command, in which case it will run the command in a shell started by "sudo" as the target user. (Similarly, sudo -...
0
votes
0answers
97 views

“docker run hello-world” not working when run as root

I configured docker in Windows 10 Home to connect with docker in WSL (Windows Subsystem in Linux). When I run sudo docker run hello-world in WSL, it gets the error message docker: Cannot connect to ...
-1
votes
2answers
39 views

How to escape wildcard in path when using sudo -u <username> command [duplicate]

I need to access a file on an NFS fileserver where root squash is turned on. I'm using bash on Arch Linux. I am using this type of command: # sudo -u authduser ls /mounted/filesystem/path/aa.user.js ...
2
votes
1answer
73 views

Is it possible to apply setuid only for a specific user?

As I understand, the setuid bit means that any user who can execute a file executes it as the file's owner. Is it possible, using ACLs or something, so that only a select list of users execute the ...
-1
votes
0answers
26 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: ...
0
votes
2answers
34 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
55 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
55 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
51 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
57 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
502 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
39 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
vote
2answers
62 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
43 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
30 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
164 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
37 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
46 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
72 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
59 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
139 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 ...