Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [sudo]

Used when executing commands as another user.

Filter by
Sorted by
Tagged with
1 vote
0 answers
17 views

Run an app without sudo password on MacOS for hidapitester (HID Device Interface) [duplicate]

I have a script that calls hidapitester binary. But I have to run this script with sudo privileges. If it's not called with sudo then it throws an error: Error: could not open device. Instead of ...
Dentrax's user avatar
  • 111
0 votes
0 answers
41 views

What steps can I take to track down what is trying to gain sudo access?

I now have a prompt that recurs every 30s wanting me to allow running some unknown sudo script. The prompt is a macos builtin prompt that takes the center of the screen and can lose focus but can't be ...
davidpricedev's user avatar
1 vote
2 answers
136 views

Have I corrupted my sudoers file? Cannot use sudo command at all

I think I may have corrupted my sudoers file. At any rate I can no longer use the sudo command (always hangs). I've read other questions related to this topic and tried to fix (going into Recovery ...
Alyoshak's user avatar
  • 111
0 votes
1 answer
46 views

MacBook Pro approve as administrator with an apple watch in clamshell

I have enjoyed the seamless integration and convenience offered by the Apple Watch to unlock my MacBook and authorize various actions without the need for password inputs. This has been particularly ...
Guillaume's user avatar
1 vote
1 answer
33 views

How do I allow the logger command to run using non superuser (sudo) privileges?

I've been trying to run the logger command in terminal but it only works with sudo. How do I allow it to work in terminal without the sudo command? I'm trying to run the logger command from ...
atreeon's user avatar
  • 528
2 votes
1 answer
257 views

sudo: command not found, despite path being set correctly

Recently, I've been unable to use the sudo command in terminal. Any command I try to give it, file I try to get it to run, etc, tells me sudo: [command or file]: command not found. If I try to run ...
GtwoK's user avatar
  • 121
1 vote
1 answer
152 views

Why isn't sudo authentication in one terminal propagated to another terminal?

When I sudo followed by a password in one terminal and then sudo in another terminal, I have to enter my password again. I am pretty sure it wasn't always like this. If I recall correctly, you could ...
d-b's user avatar
  • 3,418
0 votes
0 answers
59 views

Remove user's access to .config and Library folders

I used the following commands to give myself access to the .config folder in order to access Google Chrome's internal files. sudo chown user ~user/.config chmod 711 ~user/.config That did not give me ...
Dave's user avatar
  • 111
2 votes
2 answers
295 views

Create script that run command as admin ,but allow non sudo/admin user to execute it

I want to run below command networksetup -setMTU en0 1280 but this requires admin credentials networksetup -setMTU en0 1280 ** Error: Command requires admin privileges. I want to create a ...
gladiator's user avatar
  • 123
0 votes
0 answers
204 views

System admin password not working

I have a 2019 Macbook Pro, Ventura. Recently, I've noticed that my system password (I am the only user, and I checked in Users & Groups) doesn't work to change my Privacy and Security settings. I ...
user129393192's user avatar
2 votes
0 answers
272 views

How to fix sudo when user is already in a group that is listed in sudoers file?

I am on MacOS Ventura 13.2. Since this update I cannot perform sudo anymore: ❯ sudo touch /test Password: est is not in the sudoers file. This incident will be reported. It doesn't make sense, ...
Danny Lo's user avatar
  • 121
1 vote
1 answer
381 views

Admin account not in sudoers

On my MacBook (OS 12.6.1) I have a primary account and a secondary one, which is an admin. In the terminal, I can su into the secondary one. However, if I try to use sudo then, I see that the admin ...
Seva Alekseyev's user avatar
2 votes
2 answers
488 views

Change sudo prompt in macos

I am trying to change the default sudo prompt that is used in macos to match what I am used to in linux. I want to know that I am expected to put my sudo password and not some other password. I tried ...
nelaaro's user avatar
  • 143
2 votes
1 answer
53 views

sudo -E -s does not preserve ZDOTDIR

Running zsh on macOS Ventura → With sudo --preserve-env -s the environment variable ZDOTDIR is not preserved but all the others are. → With sudo --preserve-env=ZDOTDIR -s the variable ZDOTDIR is ...
Damien L's user avatar
  • 259
0 votes
1 answer
238 views

Why some commands do NOT require sudo when logged in GUI?

I created a user called dummy. I login using Terminal into dummy and try to put Mac to sleep using pmset sleepnow. It does NOT work: Sleep error 0xe00002c1; You must run this as root.. I log into ...
MacDada's user avatar
  • 101
0 votes
0 answers
65 views

Ansible: Accidentally changed admin user to standard user - no longer in sudoers file

I have been learning how to use Ansible to administer my machines lately. I ran a playbook that creates a new user named patrick on the target machine. This machine is a Macbook with user patrick ...
Moose's user avatar
  • 101
0 votes
0 answers
359 views

How to run an R script from the terminal

I've spent over a week on this problem, been down so many rabbit holes, and I'm about to pull my hair out. All I want to to is be able able to navigate to my folder in the terminal, run the command ./...
user2954167's user avatar
1 vote
0 answers
532 views

How to fix "sudo" waiting a minute on macOS?

On my MacBook Air (macOS 12.5) I need to use the sudo command quite often. And I noticed that when I use sudo on the command line it sometimes takes a very long time before the prompt to enter the ...
Alex's user avatar
  • 2,444
1 vote
1 answer
275 views

Accidentally moved my files with a sudo command to a non-existent directory. Now I can't find my files

On my mac, I tried moving all my .pdf files from my /Downloads directory to my documents directory but I made a typo. I used the following command: sudo find Downloads -name "*.pdf" -exec mv ...
Ekos's user avatar
  • 13
1 vote
1 answer
242 views

I accidentally removed /etc. Now I cannot login or put it back

I deleted the /etc/ folder and it is now in Trash. I cannot put it back as it needs permission, and when sudo asks for the password, I enter and it doesn't work (as everything seems was in that etc). ...
Dr.jacky's user avatar
  • 141
0 votes
0 answers
336 views

Set my current user as root user

I just got my freshly repaired macbook back. On the old version of it, I had run a command to stop getting access denied when trying to install from the terminal without using sudo. I don't remember ...
hissroth's user avatar
  • 101
4 votes
1 answer
2k views

M1 Mac (Monterey 12.4) Touch ID is not working for sudo

I followed [this set of instructions] for adding Touch ID authentication to sudo, but it's not working. Almost all the post/questions I found on the internet was more or less same and also they were ...
Sanaf's user avatar
  • 143
1 vote
1 answer
3k views

/etc/sudoers is world writable and unable to change permissions on macOS M1 [duplicate]

I’m developing a web application and I had a problem saving an uploaded photo to a specific file so it can be retrieved from the database. An error occurred that failed to open the file stream. I ...
Rana's user avatar
  • 11
3 votes
1 answer
613 views

Touch ID window for sudo doesn't get focus when opened from iTerm

I enabled Touch ID for sudo using pam_tid.so, the problem is whenever I run a sudo command in iTerm, the Touch ID window opens but it is not focused, like this: and holding my finger on the touch ...
Sassan's user avatar
  • 143
0 votes
1 answer
82 views

Renamed files to MD5 hashes, how to do so for one directory?

I used this command and ended up damaging several directories' worth of files, not system-critical files on macOS Monterey 12.2.1, MacBook Pro 13-inch 2020: find . -type f -exec bash -c 'mv $1 "${...
avenas8808's user avatar
5 votes
4 answers
7k views

How to reach the /etc folder from cd /Macintosh/ HD?

I use Monterey macOS v12.3. Do you know how can I find the /etc folder from the cd /Macintosh/ HD? I corrupted my sudoers and I want to modify it from single-user mode, but I am not able to reach the ...
Omar M. Ahmed's user avatar
1 vote
2 answers
703 views

sudo ownership and permission changed and shows `sudo: /usr/local/bin/sudo must be owned by uid 0 and have the setuid bit set`

I made another admin account in my MacOS Monterey for my programming job. Then I had to change ownership of Homebrew directories to make it work. sudo chown -R $(whoami) /usr/local/Homebrew/ /usr/...
Ario's user avatar
  • 111
0 votes
1 answer
572 views

Running sudo with a specific shell

Suppose the default shell for root is sh, my default shell is zsh, but I want to run a command in csh with sudo. How? According to man sudo, -l will give zsh (my shell). -i can give me csh, but only ...
WGroleau's user avatar
  • 5,065
0 votes
1 answer
303 views

Restore session (reopen windows) after a **CLI** shutdown on Big Sur

I'm automating some tasks, like brew upgrade then shutdown, or Duplicati backup (no Time Machine), wait for cloud sync then shutdown, but I can't seem to find a CLI command which WILL reopen my ...
antivirtel's user avatar
1 vote
0 answers
104 views

How can I enable File Sharing & Remote Login from a utility or script?

I would like to leave File Sharing and Remote Login off normally, but be able to remotely turn them on if and when I need them. The commands to do this are easily found online. sudo launchctl load -w ...
iconoclast's user avatar
  • 10.1k
4 votes
0 answers
278 views

Screen-sharing and Touch ID

On macOS Monterey I would like to use sudo without password by using Touch ID while sharing my screen during a Zoom call. I added auth sufficient pam_tid.so to /etc/pam.d/sudo and it works fine while ...
user60589's user avatar
  • 190
0 votes
0 answers
235 views

rm /bin/date "operation not permitted"

I would like to sudo rm /bin/date but I get this message: Password: override rwxr-xr-x root/wheel restricted,compressed for /bin/date? y rm: /bin/date: Operation not permitted Please assume that I ...
imagineerThis's user avatar
-1 votes
1 answer
2k views

How can I delete the files in /System/Volumes/VM?

Just as an experiment/exercise, I tried deleting the swap files in /System/Volumes/VM but no matter what I did, it was prevented. sudo rm - operation not permitted sudo xattr - didn't return anything ...
d-b's user avatar
  • 3,418
0 votes
1 answer
2k views

How to add an admin user to sudoers on Big Sur [duplicate]

I am running Big Sur on a MacBook Pro and am unable to run su or sudo in a terminal window despite being logged into an Admin (and Mobile) account. I always get the error: <username> is not in ...
Ellen Spertus's user avatar
0 votes
0 answers
1k views

macOS keeps asking for root password in Terminal

Today, my mac mini keeps asking for root password every time I enter Terminal or open new terminal window. Android Studio and other apps that have terminal access do the same and keep asking root ...
AVEbrahimi's user avatar
2 votes
0 answers
270 views

Disable TouchId when resuming from suspend BUT leaving it enabled for sudo

I've recently switched my development setup to a new M2 Mac Book Air with Touch ID support. Right now I'm tailoring my laptop to my liking. I've added Touch Id as a supported PAM authentication method:...
Grzegorz Uriasz's user avatar
0 votes
1 answer
1k views

Sudo commands makes error which tells sudoer has missing "__chkstk_darwin" symbol

My problem on my macOS High Sierra is that recently none of sudo commands are working. here is a sample, Majids-MacBook-Pro:etc mjzarrin$ sudo vi x.txt dyld: lazy symbol binding failed: Symbol not ...
Ario's user avatar
  • 111
2 votes
3 answers
531 views

Avoid changes to /etc/pam.d/sudo across macOS updates?

I have a custom /etc/pam.d/sudo setup and I noticed that the file was always reset to default when macOS updates itself. How do I prevent that from happening?
Teddy C's user avatar
  • 1,792
0 votes
0 answers
35 views

sudo: /etc/sudoers is owned by uid 501, should be 0 not mounting for recovery [duplicate]

I edited my etc/sudoers file to try to disable the requirement for sudo password. Now I can't run sudo commands in the terminal. I get the following error: sudo: /etc/sudoers is owned by uid 501, ...
display's user avatar
0 votes
1 answer
364 views

Is setting a sudo time limit to 0 seconds still required for secure macOS operations?

I am used to set Default timestamp_timeout=0 in /etc/sudoers via the visudo command when configuring a new macOS. The reason originally was that applications can start shell scripts and it used to be ...
gctwnl's user avatar
  • 714
2 votes
3 answers
4k views

Should I enter this command in Terminal?

Background: A month or so ago I purchased an app from a developer with (what seemed to me to be) a decent reputation. The app did not work as expected, so I reached out to tech support, who got back ...
mweiss's user avatar
  • 1,108
0 votes
0 answers
215 views

Downloads from web browsers randomly bypass my downloads folder and go directly to my iCloud drive (desktop)

When I would download files, they would always automatically go into my downloads folder. I have not done anything recently except fix the indexing on this mac with a sudo command. Shortly after, ...
hurzt's user avatar
  • 1
0 votes
0 answers
593 views

sudo: /private/etc/sudoers.d is owned by uid 501 should be 0 - unable to run sudo commands on terminal - big sur [duplicate]

My brew command was getting stuck without any output. So I tried reinstalling brew. When I try to re-install using: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/...
Siddhant's user avatar
  • 101
2 votes
1 answer
8k views

user is not in the sudoers file macOS catalina

I'm using macOS catalina 10.15.7. I recently found out i cannot run sudo anymore, tried to run sudo brew install nats-server, and got this message: <myusername> is not in the sudoers file. This ...
user468587's user avatar
0 votes
1 answer
3k views

sudo: /private/etc/sudoers.d is owned by uid 501 should be 0 - unable to run sudo commands on terminal (macOS Big Sur 11.3.1)

When I Run Any Sudo Commands I get: sudo: /private/etc/sudoers.d is owned by uid 501, should be 0 sudo: no valid sudoers sources found, quitting sudo: error initializing audit plugin sudoers_audit ...
imprvstack's user avatar
2 votes
2 answers
805 views

How to open another Account's User folder using Terminal?

I used to be able to use one of these commands to switch to another user account (my own) to work on it. john$ login admin password: admin$ open . LSOpenURLsWithRole() failed with error -610 for the ...
John's user avatar
  • 1,071
0 votes
1 answer
6k views

What service to restart after modifying /etc/sudoers for macOS to make changes active without reboot?

What's the service that needs to be restarted after modifying /etc/sudoers for macOS in order to make changes active without a system reboot?
ylluminate's user avatar
  • 5,461
3 votes
1 answer
117 views

Enable sudoing for the logged-in user for one specific prefpane only?

We are running OS X 10.14 VMs hosted on VMWare ESX. Users log into the VMs via Screensharing app. VMWare sets the resolution settings to an odd value, so the users would have to use a VMWare command ...
Stefan's user avatar
  • 111
0 votes
0 answers
195 views

"/etc/sudoers is world writable” on Mac OS Mojave [duplicate]

I have gone through a lot of google results. Let me explain what I have tried first. I am currently working on a corporate laptop. Mac OS Mojave 10.14.6. Error that I get: sudo: /etc/sudoers is world ...
Nevin's user avatar
  • 101
2 votes
1 answer
1k views

How can I remove unwanted preinstalled apps from macOS?

In macOS there are a lot of pre-installed bloatware applications. I know that I will never use them. Examples of such apps are: Chess, Stocks, Messages, TV and so on. While some of them may not take ...
Ashark's user avatar
  • 159

1
2 3 4 5 6