Skip to main content

Questions tagged [sudoedit]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
180 views

How to run a bash script by double clicking by entering the path in sudoers?

Using sudo visudo I add the line username ALL=(ALL) NOPASSWD: /home/user/script.sh in sudoers but the script.sh does not run on double click. If I add the line username ALL=(ALL) NOPASSWD:ALL in ...
moninah's user avatar
  • 15
0 votes
1 answer
44 views

How can I allow a single member of group as sudoer

I am looking for a solution to a use case where a group is granted sudoer privileges. However, only one specific user or member within that group should have sudoer permission privileges, while the ...
govind Lalit's user avatar
1 vote
1 answer
991 views

sudoers syntax error near line 1 while adding cmnd alias

I am attempting to modify the sudoers files located within the sudoers.d directory to allow a group named "swts" to perform a cp and chown as part of an automation job. To accomplish this, I ...
Rahul Kodumuru's user avatar
1 vote
0 answers
156 views

I created a new user, and this user is recognized as a root user, how do I return him back to a normal user

I execute a normal command to create a file and it tells me access is denied, after that I use Sudo the file I created belongs to the root user and not to the user I created whoami returns user1 ls -l ...
Naruto's user avatar
  • 41
8 votes
2 answers
2k views

Difference between sudo -e and sudo vim?

Is there a key difference between sudo -e and sudo vim. I have set up the sudoers file so that vim is my default editor. Is there a key difference between the two? Plus, should I switch from vim to ...
Peter Petigru's user avatar
0 votes
1 answer
30 views

My user (tom) has user_u , user_r and user_t via semanage but it still can perform sudo

My user (tom) is mapped to user_u user , user_r role and user_t domain via semanage [tom@localhost ~]$ id -Z user_u:user_r:user_t:s0 [tom@localhost ~]$ because I have made the "default" as ...
Rock's user avatar
  • 3
0 votes
1 answer
161 views

sudoers - when command is run as a specific user

I wish to keep certain environment variables when a certain command is run as a certain user under sudo. man sudoers seems to suggest that Defaults can do this, if I've read the paragraph copied below ...
ian's user avatar
  • 169
3 votes
2 answers
3k views

Using Visual Studio Code as EDITOR e.g. with sudoedit

I am using Kubuntu 20.04. When I run sudoedit /etc/fstab, VS Code opens to a blank document and the CLI immediately returns (see details below). If I run export SUDO_EDITOR=nano, the document opens in ...
kevcoder's user avatar
  • 485
0 votes
1 answer
219 views

Sudoers rpm command problem

Could you please help with below command. I need run without password prompt, But it requires password for user: Cmnd_Alias user_RPM_YUM = /bin/rpm --allmatches -e $(rpm -qa blabla*) --nodeps ...
user460483's user avatar
0 votes
0 answers
129 views

how to run script from user hdfs without password

we create the following script on rhel 7.6 /home/run_tasks and in visudo we configured %sudo ALL=(ALL:ALL) ALL root ALL=(ALL) ALL hdfs ALL = (ALL) ALL hdfs ALL= (root) NOPASSWD: /home/...
yael's user avatar
  • 13.4k
0 votes
2 answers
6k views

sudoers file change not working? [duplicate]

I'm in Ubuntu 18.04LTS and I want to change the sudoers file to execute sudo shutdown -h now without the need of password (for my_username). The steps I take were: With my user my_username open ...
Aurelie Navir's user avatar
1 vote
0 answers
138 views

sudoedit ignores sticky bit when checking for directory writability

sudoedit does not allow editing files when the original user has write access to one of the parent directories (as explained here). However, I'm noticing that sudoedit does not seem to take into ...
Alex Robbins's user avatar
0 votes
1 answer
872 views

Uploading sudoers.d file through ansible gives syntax error but opening and saving in vi fixes it

Alright, I know the question title sucks, but it's the same with the situation itself. What I am trying to do is this: Create a file with sudoers configuration locally Use Ansible to ubload that ...
Thorian93's user avatar
  • 753
5 votes
5 answers
17k views

How can I add lines into my sudoers file?

I have read this answer but don't know how to add the following line into my sudoers file. matthew ALL=(ALL) NOPASSWD: /usr/sbin/service fancontrol start I ran "sudo visudo", and a "/etc/sudoers.tmp"...
Matthew Wai's user avatar
3 votes
1 answer
19k 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 ...
Rajat jain's user avatar
12 votes
2 answers
3k views

Why is sudoedit writing to a temporary directory?

I used sudoedit to create a file: $ sudoedit /etc/systemd/system/apache2.service but when I went to save the file, it wrote it in a temporary directory (/var/temp/blahblah). What is going on? Why ...
Tyler Durden's user avatar
  • 5,773
2 votes
1 answer
2k 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 ...
iizno's user avatar
  • 179
0 votes
0 answers
139 views

/etc/sudoers problem, config works on machine B, but not on A

I've created a user noc and gave it a permission to run with sudo. I've added the following lines to the sudoers file. Cmnd_Alias NOC = /etc/init.d/tomcat noc ALL=(ALL) NOPASSWD: NOC Problem is that ...
Ali Golestan's user avatar
1 vote
0 answers
780 views

Enable regular users to install new packages from both - Gnome-software and apt

I'm on Debian 9 with Gnome. I would like to enable regular users to install new packages from both: Gnome software center (GUI application), and apt (via command line). How can I achieve both?
user1876484's user avatar
4 votes
1 answer
11k views

How do you run a command with sudo in `~/.profile`?

Is it a bad practice to run a command which requires sudo in ~/.profile? If really want to do that, how can I make the command run at rebooting Ubuntu? make the command running with sudo and under ...
Tim's user avatar
  • 103k
0 votes
1 answer
3k views

"sudo -l" says I can sudoedit a file, but won't let me

I am logged into my system, and when I type sudo -l it shows: $ sudo -l Matching Defaults entries for user1 on WINNING: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/...
Fallenreaper's user avatar
3 votes
2 answers
4k views

Can I sudoedit a file in a writable directory when using vimdiff?

When I want to vimdiff root files, I use the following alias, as per this suggestion. alias sudovimdiff='SUDO_EDITOR=vimdiff sudoedit' I can then use the following command. $ sudovimdiff /root/a /...
Sparhawk's user avatar
  • 20.1k
3 votes
1 answer
624 views

sudoers rule to start and stop eth interface

I got syntax error when i add this rules to sudoers : ifdown eth0:1 ifup eth0:1 I also try with : ifdown eth0\:1 ifup eth0\:1 And: ifdown "eth0:1" ifup "eth0:1" How to allow a non root user to ...
Med's user avatar
  • 135
0 votes
1 answer
549 views

Sudoers overwritten by unknown instance

After org.kde.pim.aconadiserver crashed on my Fedora 25 workstation after running pkill to get the progress of a dd copy and Kde did a slow restart after some time, I could not use sudo with my normal ...
rudib's user avatar
  • 1,632
1 vote
2 answers
784 views

Nano through Sudoedit = No colors

Here are my personal aliases for editing root owned files: # CLI superuser nano; compiled; version 2.8.0 function sunano { export SUDO_EDITOR='/usr/local/bin/nano' sudoedit "$@" } # GUI ...
Vlastimil Burián's user avatar
13 votes
1 answer
8k views

sudoers and defaults

I need to allow to a user to run passwordless sudo without tty. I have a file under /etc/sudoers.d/ with the special commands and settings I need, since I don't fancy editing directly the sudoers ...
Navarro's user avatar
  • 480
9 votes
1 answer
11k views

sudoedit root owned file in a non-root directory

Why can't I edit files owned by root but being e.g. somewhere deep in my personal directory, it says: sudoedit: existingFile: editing files in a writable directory is not permitted While I have the ...
Vlastimil Burián's user avatar
8 votes
2 answers
12k views

How to properly edit system files (as root) in GUI (and CLI) in Gnu/Linux?

System: Linux Mint 18.1 64-bit Cinnamon. Objective: To define Bash aliases to launch various CLI and GUI text editors while opening a file in root mode from gnome-terminal emulator. Progress For ...
Vlastimil Burián's user avatar
3 votes
1 answer
1k views

Accidentally set write permission on sudoers?

I'm currently running Mac OS Sierra. I don't know exactly how, but somehow I've altered some permissions and think it'd be a good idea to reset them, but I do not know how. Each time I execute sudo, I ...
Stephen Boyette's user avatar
0 votes
1 answer
605 views

linux + visudo + how to remove sub folder and sub files

I edit in visudo the following , in order to enable user to remove any folder or file under /var/log/http/ include sun folder UserT ALL=(root) NOPASSWD: sudoedit /var/log/http/* user can remove ...
yael's user avatar
  • 1,529
7 votes
4 answers
4k views

Sudoers blacklist

We need to add few users to the sudoers file on Linux. They should be able to to anything root can except the following: Should not modify, read, delete /nfsshare/config Should not modify, read, ...
sagar's user avatar
  • 259
2 votes
2 answers
781 views

sudoedit but no cp

I have access to a file /etc/apache/myfile.conf that gets included in httpd.conf. The permissions are: -rw------- 1 root root I have sudoedit permission to the file but not read! I can open the ...
Kalpesh Soni's user avatar
2 votes
3 answers
4k views

how to make a large command line broke in two lines be executed as a single line inside of a script

I am using IBM z/OS390 and I am using the OMVS shell. I don't have "vi" installed at all so I use "oedit". If I try to initialize the app.jar straigh from OMVS shell it Works perfectly. I mean, if I ...
Jim C's user avatar
  • 145
0 votes
1 answer
107 views

How to forbid ssh connection after sudo -u

After ssh login, user with UserName makes $ sudo -u localusername -i and $ ssh localusername@someserver How to forbid ssh localusername@someserver for UserName via sudo -u localusername but permit it ...
Ragnar Lodbrog's user avatar
0 votes
1 answer
2k views

Now visudo won't work at all

RHEL 5.10 When I do visudo I get this error: chuck 75->visudo visudo: /etc/sudoers: Permission denied visudo: /etc/sudoers: Permission denied Listing of sudo exe file and /etc/sudoers: chuck ...
Bulrush's user avatar
  • 229
1 vote
0 answers
47 views

Why does visudo compare the contents of `VISUAL` to a fixed whitelist? [duplicate]

This is on Ubuntu 15.10 I'm trying to get a better understanding of visudo and how it works. The documentation explains that visudo will consult the VISUAL environment variable and compare it against ...
Greg Nisbet's user avatar
  • 3,086
1 vote
1 answer
696 views

Getting password prompt after editing sudoers file in cent OS 7?

Part of my sudoers file lines begingin with mukesh are edited: ## Allow root to run any commands anywhere root ALL=(ALL) ALL mukesh ALL=(ALL) SOFTWARE,DRIVERS mukesh ALL=(root) ...
munish's user avatar
  • 8,057
2 votes
2 answers
7k views

Enable user to execute one command as another user

The goal is to let the www-data user execute sudo -u postgres -H osm2pgsql [some options here] without being asked for a password (as this will be part of a script wich runs automatically). I thought ...
Matthias's user avatar
  • 1,093
1 vote
2 answers
3k views

How do I fix my /etc/sudoers file to recognise me?

Currently, I am receiving the following terminal error: sudo: parse error in /etc/sudoers near line 10 sudo: no valid sudoers sources found, quitting sudo: unable to initialize policy plugin I have ...
Linuxn00b's user avatar
  • 131
0 votes
1 answer
727 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 ...
ArchiT3K's user avatar
  • 577
3 votes
1 answer
40k views

pam_unix(sudo:auth): auth could not identify password for [asteriskpbx]

to install the asterisk program, I created a sudo user and added to /etc/sudoers file like this: asteriskpbx ALL=(ALL) NOPASSWD: ALL but, when I try to start the service, I get the following report:...
Saman's user avatar
  • 371
6 votes
1 answer
795 views

How can I make `sudo crontab -e` use my `sudoedit` environment?

I've started using sudoedit <file> instead of sudo vim <file>. One of the advantages is that it uses my local ~/.vimrc. However, when using sudo crontab -e, it uses /root/.vimrc instead. ...
Sparhawk's user avatar
  • 20.1k
3 votes
1 answer
2k views

Using sudoedit in a script (non-interactively)

I'm looking to modify a file from a script. I can sudoedit the file as the bob user by doing sudoedit -u bob /foo/bar.conf but don't have rights to do anything else as bob. I came across http://...
mdjnewman's user avatar
6 votes
3 answers
1k views

What bad things could happen if we don't use sudoedit?

We know it's safer* to use sudoedit, but what bad things can happen if we have the following in sudoers? Cmnd_Alias FOO = /bin/ed, /usr/bin/ed, /usr/bin/vi foouser LOCALHOST = NOPASSWD: NOEXEC: FOO ...
freaking-good-question's user avatar
1 vote
2 answers
889 views

Is there a sudoedit equivalent for vimdiff?

I'm trying to get into the habit of editing root-owned files with sudoedit, instead of sudo vim. This has a few advantages, one of which is that it uses my user's ~/.vimrc. Is there an equivalent, ...
Sparhawk's user avatar
  • 20.1k
1 vote
1 answer
3k views

How to give Root privileges for User in Centos 6.2 minimal

I installed Centos 6.2 minimal x86_64 server in Virtual Machine Manager. After installed I created Username in the server. And I added the User into a wheel group. # useradd testuser # ...
Beginner's user avatar
  • 1,960
3 votes
2 answers
3k 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 ...
Babin Lonston's user avatar
3 votes
2 answers
457 views

visudo/sudoedit and gvim --remote-silent

Is it possible to use gvim --remote-silent and similar as an editor for visudo and sudoedit? Actually, I don't think this is related to the --remote option. Even if I set Defaults editor = "/usr/bin/...
ABP's user avatar
  • 93
3 votes
1 answer
13k views

sudoers - How to use NOPASSWD and sudoedit at the same time?

What is the syntax for using NOPASSWD and sudoedit at the same time in /etc/sudoers? I tried this: john ALL=(ALL) NOPASSWD: sudoedit /path/to/file but I still get prompted for a password.
Pavel Tankov's user avatar
7 votes
5 answers
4k views

Sudoedit Vim force write (update) without quit

I'm doing some scripting with Vim and I've just started using sudoedit. Problem is, when I :w it writes to the temp file, so any testing of the script can't happen unless I quit the editor. How can ...
Ben's user avatar
  • 175