Questions tagged [sudo]

Used when executing commands as another user.

Filter by
Sorted by
Tagged with
2 votes
1 answer
83 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
121 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,266
0 votes
0 answers
48 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
136 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
116 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
248 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
198 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
341 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
  • 133
0 votes
0 answers
34 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
  • 227
0 votes
1 answer
207 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
52 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
259 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
360 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,082
1 vote
1 answer
230 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
159 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
268 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
2k 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
2 votes
1 answer
424 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
  • 133
0 votes
1 answer
78 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
6k 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
647 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
441 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
  • 4,670
0 votes
1 answer
251 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
99 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
  • 9,359
4 votes
0 answers
205 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
216 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,266
0 votes
1 answer
1k 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
1 vote
0 answers
234 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
887 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
1 vote
3 answers
379 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,628
0 votes
0 answers
34 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
252 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
  • 654
1 vote
3 answers
3k 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,080
0 votes
0 answers
167 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
477 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
7k 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
2k 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
671 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
  • 989
0 votes
1 answer
3k 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,232
3 votes
1 answer
104 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
831 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
0 votes
0 answers
1k views

How can I get permissions for brew?

As recommended, I created an admin user and a regular user which I use for regular usage. for some reason I keep getting asked for my sudo admin password (when installing apps, updating apps, etc) - I ...
Kar19's user avatar
  • 101
0 votes
0 answers
39 views

Syntax Error in etc/sudoers and can't edit it in terminal [duplicate]

I was/am trying to run terminal commands without having to use sudo first and must have broke the file. Now I'm trying to fix it and it's giving me this error when I try to edit with the same sudo ...
alcoven's user avatar
  • 101
11 votes
2 answers
4k views

pam_tid.so asks for password instead of requesting for fingerprint when docked

I used to use auth sufficient pam_tid.so in the /private/etc/pam.d/sudo file to allow fingerprint authentification when using sudo command. Recently upgraded my MBP for a new M1 under macOS Big Sur (...
mperrin's user avatar
  • 343
0 votes
0 answers
616 views

Shimo/Clean My Mac require passwords after messing with sudoers

I messed with sudoers file and sudo was not working. I fixed the issue (booted from recovery mode, mounted root filesystem and fixed permissions) and sudo is now working properly, but after this ...
Santiago's user avatar
2 votes
1 answer
357 views

When do processes run under root by default?

I know that when I use "sudo" an application can run under root, or if a window appears saying "Application wants to make changes to the system, enter your password for this", they ...
BabyBoy's user avatar
  • 847

1
2 3 4 5 6