Questions tagged [sudo]

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

Filter by
Sorted by
Tagged with
-1
votes
1answer
21 views

What's the magic path for npm when using sudo?

I remember I was able to use something like sudo ${which npm} run xxx when I needed root privilege to run npm. What is it?
0
votes
0answers
13 views

How can I rename sudo user in Mac OSX

In mac I've changed the username via preferences from oldname -> newname However sudo su username remains the same it hasn't changed. How can I change that?
1
vote
0answers
37 views

How to permit the chown use to a regular user, but only on its home directory?

I'm trying to allow regular user A to execute chown command to a list of user B,C,D having as object any files located into its home directory. In other words, I would try to limit the chown "root ...
-2
votes
2answers
46 views

How to protect from coworkers [closed]

Hello how to protect linux account form other administrators(coworkers) in company who can use your account to steal data and point a police that you are the guy who steal data from company. if ...
1
vote
1answer
42 views

When root opens crontab Vim is used although Nano is set as the default editor. Why might this be?

Environment: CentOS 8 Question: When I enter sudo crontab -e it opens in Vim. However Nano is set as the default editor and for every other type of file it is used as expected. Why might this be? ...
0
votes
0answers
10 views

Sudoers and setfacl command with arguments (:, " chars)

in a case of a deployment script (https://github.com/EasyCorp/easy-deploy-bundle/blob/master/doc/default-deployer.md#security-options) I need to run setfacl from a distant machine that push code. To ...
1
vote
0answers
125 views

PAM: password authentication failed for remote user

I am executing a command from server1 which would do a remote ssh to server2 and execute certain commands as olcne user. I am seeing some exception in /var/log/secure file wrt to pam. Can someone ...
0
votes
1answer
23 views

Control a systemd service through a web application built in python3

I have created a web app in python3 which is hosted on a apache2 web server using the wsgi module. Now one of the requirements of the web application is that it needs to restart a systemd service ...
0
votes
2answers
145 views

Is using sudo a bad practice?

I heard that using sudo for creating files is a bad practice(for security reasons) and should instead "confine them" to user or a group, can someone make me and example of what could go wrong if I go ...
1
vote
1answer
68 views

Looping transfer SSH keys while opening SSH access of my VM

Yesterday, I was able to connect to my VM without any problem. Today, when I wanted to connect, it just loops over "Transferring SSH keys to VM". When I go in the console, it loops the same thing. [ ...
0
votes
0answers
23 views

Locked of Server, how to run sudo passwordless

Here is the issue Created a new server with Amazon Linux 2 Removed ssh-key from default root user (ec2-user) Created two new accounts with sudo access without a password Now I got locked out of the ...
2
votes
2answers
83 views

rsync command works in terminal, fails in rundeck

I'm trying to use rundeck to rsync files in a docker container volume to an offsite server. I can impersonate the rundeck user and run the rsync command in a terminal window just fine. When rundeck ...
0
votes
0answers
23 views

Reduced subset of devices available under /dev when Postfix invokes a piped script via sudo defined in /etc/aliases file

This is a CentOS 8 install running Postfix version 3.3.1, and I'm experiencing behaviour that I have not seen before, and I have no idea how to fix the issue. To provide context, I have a self made ...
0
votes
1answer
76 views

How do I create a proper sudoer rule for an Ansible handler?

Is it possible to use become in a handler? We are running ansible 2.9.3 on a RHEL 7.4 machine. We have a user who is modifying some config files for a daemon (Consul), and we want the service to ...
0
votes
0answers
53 views

Any downside to using `sudo git` to upload `/etc/nginx/sites-available/` and `/etc/nginx/ssl/` config files on github?

I'm contemplating uploading config files from /etc/nginx/sites-available/ and /etc/nginx/ssl to a private Github repository. Doing so would require me to use git with sudo (or from root user) for the ...
0
votes
1answer
94 views

On RedHat 8, is using SUDO to perform tasks as privileged (like starting a systemd service) user deprecated in favor of using PolicyKit?

Just a bit of context... I got some legacy System V Init script that were converted to Systemd unit configuration files for RedHat 7. Problems with abrupt termination of user processes running in the ...
0
votes
1answer
28 views

How can I mount a hard drive with read/write permissions for all the users listed on the Linux server?

Two users user1 and user2 are registered on the server, both with sudo access. user1 mounted a hard drive with: $ sudo mount /dev/sda /media/user1/DATA $ ll /media/user1 total 12K drwx------ 19 ...
0
votes
0answers
67 views

I am using 'sudo apt-get clean' too often nowadays, how can I avoid using it again?

I have a LAMP server hosted by Digital Ocean that has been running for more than 3 years. I use the server to run an ERP page where users have to log in to do what they need to do. Up until recently ...
0
votes
1answer
53 views

Allow apache service to execute command on another user with sudo. Set correctly SELinux

I want allow PHP script to execute external command with another user with exec. For this, I call my command like : exec('sudo -u username /usr/bin/command -a arg1 --arg2 arg2'); In sudoers rules, I ...
0
votes
1answer
68 views

Do I need to specify the user:group in sudoers to impersonate other users

I was trying to limit the command a specific user can execute in the sudoers file, say I have something like this: dummy myserver=(ALL:ALL) /usr/sbin/reboot,/usr/sbin/shutdown My dummy user is only ...
40
votes
1answer
3k views

Why can I update a file owned by root using sudo vi, but not append a line to it with sudo echo “Thing” >> file?

I would like to have script that is doing automated migrations of websites from another be able to append Includes to the /etc/httpd/conf.d/vhosts.conf file. However, when I try to use echo to put ...
0
votes
1answer
149 views

Effect of chmod -R 777 *

A newbie here. Can someone help me understand what are the effects of running the following command from a directory: sudo chmod -R 777 * Will it effect the whole file system or the contents of ...
0
votes
1answer
62 views

Cent OS 7 - remove sudoer user without deleting that user

I want to remove sudo permission from sudoer user without deleting it. I got this answer in debian as: sudo deluser USERNAME sudo But it doesn't work in centos. Thank you!!!
0
votes
1answer
61 views

For specific user, refuse sudo immediately, do not ask for password

For a specific user or list of specific users, I want to make it so they are not even asked for a password but just directly refused. Although this is after I've allowed them 1 specif command. so the ...
0
votes
1answer
35 views

How to avoid using sudo after creating a new partition in a linux server

After creating a new partition (and mounting), for every operation I wish to make I have to use sudo command beforehand. For example, in order to make a new directory: mkdir new_dir would be denied, ...
0
votes
1answer
992 views

FreeIPA sudoers rule - how to add NOPASSWD for ALL commands (no prompt for password)

Using FreeIPA for sudoers rules and I am attempting to create what would be the same as standard sudoers line(s) of: user ALL=(ALL) NOPASSWD:ALL group ALL=(ALL) NOPASSWD:ALL to allow a specific user ...
1
vote
1answer
24 views

kernel tunables for non privileged user

How can i permit non privileged user to set kernel tunables within specific limit. For instance to let user set hugepages up to 40 sysctl -w vm.nr_hugepages=40
15
votes
1answer
1k views

Sudo directive in /etc/sudoers.d doesn't work (but it's fine if it's in /etc/sudoers)

I wish to add a file to the /etc/sudoers.d folder that includes a directive to allow www-data to run one specific script with no root password. The directive is www-data ALL=(ALL) NOPASSWD: /path/to/...
0
votes
0answers
14 views

AWS ec2 Debian users can run commands with sudo without being in the sudoers file

I'm trying to work out why users in my AWS EC2 Debian instances can run sudo commands without being in any groups which allow these kind of permissions. This is my sudoers file: Defaults ...
0
votes
1answer
144 views

Configuring sudo on CentOS with LDAP run by Synology Diskstation

I am trying to set up a CentOS 8 workstation to authenticate against a LDAP server run by a Synology DiskStation. I have been able to successfully configure SSSD to authenticate users against the ...
0
votes
1answer
141 views

sudo won't read file at /etc/profile.d/*.sh

I just create a file at /etc/profile.d/texlive.sh where I export paths from textlive. When I log as root tlgmr is in path, when I log as normal user too but when I doo sudo tlmgr install xelatex I ...
0
votes
1answer
46 views

Linux: how to prevent user from restarting services?

I need to prevent sudo user from start/restart or stop multiple services. I'v edited /etc/sudoers: Cmnd_Alias LIMITED_CMDS=/bin/su,/bin/systemctl stop nginx,/bin/systemctl start nginx,/bin/systemctl ...
1
vote
2answers
312 views

Bash script: Asking for sudo password only once

I'm working on a backup bash script, which does a bunch of long rsync jobs. Some take up to 3 or 4 hours each. After these big transfers, I wish to flush the disk cache after syncing the files before ...
0
votes
1answer
77 views

Sudoer with permission denied

I have a user in sudoers which has entry like user ALL=(ALL) NOPASSWD: /usr/bin/find then that user will try to do /usr/bin/find /var/mailboxes -iname mailbox@domain.net but results will be ...
1
vote
1answer
65 views

openvpn can't sudo within “down” script when shutting down systemd service

OS: Ubuntu 16.04.2 LTS My VPN config has directives: user ovpn group ovpn up "/path/to/my/script" down "/path/to/my/script" My visudo file has the directive: %ovpn ALL=(ALL:ALL) NOPASSWD: /sbin/...
0
votes
0answers
22 views

Recover root access after wrong usermod -g in Ubuntu 14

I have to recover root access to an Ubuntu 14 box where there is only a single local user and usermod -g somegroup ... has been executed instead of usermod -G ... so the user can't sudo anymore. I am ...
0
votes
1answer
164 views

Permission issue starting mongo from a script

If I run the following command, everything works as expected: sudo mongod --fork --dbpath /path/to_data/ --port 27027 --syslog However, if I put the following command in startmongo.sh and run it ...
0
votes
1answer
92 views

Sudo parse error while running any sudo command [duplicate]

The following error is triggered when I run sudo apt update >>> /etc/sudoers.d/README: syntax error near line 1 <<< sudo: parse error in /etc/sudoers.d/README near line 1 sudo: no ...
10
votes
3answers
3k views

Is it insecure to have an ansible user with passwordless sudo?

I'm new to Ansible. Most VPS provisioning guides I've seen so far do this: disable root from logging in create a new user who can only log in with ssh (not password) add the new user to the wheel ...
0
votes
1answer
30 views

Prevent logging of environmental variables in sudo

I'm trying to provide a secret value to a script, via an environmental variable, but not have it logged by sudo in auth.log. At the moment I have the file: /etc/secret-key export SECRET_CONFIG_KEY=...
0
votes
0answers
57 views

execute pon without sudo/root

I would like to be able to start my VPN to a server via a home-made HTML page. When I execute pon from the CLI , as a logged in user (not root), it returns with error: /usr/bin/pon: 57: exec: /usr/...
0
votes
0answers
46 views

How to allow apache2 PHP to run sudo on Debian

I used to have this working, but at some point it stopped. I have a PHP script that needs to run a shell script as another user (not root) so I use: sudo -u otheruser /path/to/script With a sudoers ...
1
vote
2answers
63 views

Limited Linux admin account just to provide VM disk drive extension

Title of the question kind of sums it up. I am deploying a network appliance as a VM based on Debian 9 but want to give the user the ability to add additional disk space if needed, however I do not ...
0
votes
0answers
32 views

How to maintain VPN connection for Ubuntu web server to access external REST API?

I have an Ubuntu apache web server that uses an external REST API whenever someone signs up for a free trial. The only way to connect to this API is via an L2TP/IPSec VPN and I can do so with ...
1
vote
0answers
36 views

Why is sudo password entering lost

When I use sudo command and pipe it to another command, e.g. sudo dnf search foo | grep bar there is a prompt requiring to enter the password. Following this answer, sudo directly accesses the ...
0
votes
0answers
139 views

using FreeIPA sudo rules, `sudo --validate` never asks for a password

I have a system that is both a FreeIPA client and has local users. I have noted that the behavior of sudo --validate is different for users that are local or FreeIPA users, even given the same ...
0
votes
1answer
79 views

How can I make a user to execute 'sudo' any command but on a specific path only?

I would like to grant sudo privileges to a user but only on a specific path. For example: user@domain $> sudo touch /etc/test/directory/samplefile where that user doesn't have permissions to the ...
0
votes
1answer
137 views

Disable sudo prompt without disabling the need for sudo password

This is quite tricky I guess, or at least not desired very often. What I am not after is: Disabling password with user ALL=(ALL) NOPASSWD: ALL Or a similar trick. I know how to read sudo ...
1
vote
0answers
25 views

New object class not available in LDAP Account Manager

I'm using LDAP Account Manager (5.7) (LAM) with OpenLDAP 2.4 on Centos 7.4 I am trying to publish sudo policy via LDAP. I have deployed the supplied schema and LDIF files to /etc/openldap/schema and ...
1
vote
2answers
4k views

Gtk Warning: cannot open display: :0 (for local user!)

I know there is a bunch of similar questions around but they are all about a X-Forewarding and SSH sessions. I got this problem with a local user which is privileged for a specific script... The ...

1
2 3 4 5
17