Questions tagged [sudo]

Used when executing commands as another user.

Filter by
Sorted by
Tagged with
1 vote
1 answer
31 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 ...
user avatar
  • 123
0 votes
1 answer
44 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 "${...
user avatar
4 votes
3 answers
794 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 ...
user avatar
1 vote
2 answers
228 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/...
user avatar
  • 111
0 votes
1 answer
48 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 ...
user avatar
  • 3,355
0 votes
1 answer
35 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 ...
user avatar
1 vote
0 answers
11 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 ...
user avatar
  • 7,220
0 votes
0 answers
38 views

How do I auto script "su admin" as a non-admin?

I can auto script "sudo su" logged in as an admin in terminal with: echo 'pa$$w0rd' | sudo -S su If I'm logging in as a standard (non-admin) user on Big Sur, I need to first login as "...
user avatar
1 vote
0 answers
52 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 ...
user avatar
  • 160
0 votes
0 answers
66 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 ...
user avatar
-1 votes
1 answer
210 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 ...
user avatar
  • 347
0 votes
1 answer
405 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 ...
user avatar
0 votes
0 answers
220 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 ...
user avatar
1 vote
0 answers
79 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:...
user avatar
0 votes
1 answer
214 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 ...
user avatar
  • 111
0 votes
0 answers
46 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?
user avatar
  • 1,076
0 votes
0 answers
33 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, ...
user avatar
0 votes
0 answers
21 views

sudo GrandPerspective.app/Contents/MacOS/GrandPerspective throws error in Catalina

I have multiple users setup on Mac. I found proposed solution on GrandPerspective board that states running the following: sudo GrandPerspective.app/Contents/MacOS/GrandPerspective would allow one ...
user avatar
  • 183
0 votes
1 answer
83 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 ...
user avatar
  • 564
1 vote
3 answers
652 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 ...
user avatar
  • 878
0 votes
0 answers
30 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, ...
user avatar
  • 1
0 votes
0 answers
109 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/...
user avatar
  • 101
0 votes
1 answer
2k 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 ...
user avatar
0 votes
1 answer
1k 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 ...
user avatar
2 votes
2 answers
269 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 ...
user avatar
  • 717
0 votes
1 answer
124 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?
user avatar
  • 4,464
3 votes
1 answer
42 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 ...
user avatar
  • 81
0 votes
0 answers
194 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 ...
user avatar
1 vote
1 answer
208 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 ...
user avatar
  • 129
0 votes
0 answers
622 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 ...
user avatar
  • 101
0 votes
0 answers
37 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 ...
user avatar
  • 101
5 votes
1 answer
1k 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 (...
user avatar
  • 261
0 votes
0 answers
313 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 ...
user avatar
2 votes
1 answer
151 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 ...
user avatar
  • 506
3 votes
1 answer
367 views

Running sudo when user has blank password?

I have a user with a blank password, but now I can't run sudo with that account. sudo ls Password: Sorry, try again. Password: Sorry, try again. Password: sudo: 3 incorrect password attempts Is there ...
user avatar
0 votes
2 answers
574 views

MacMini M1 broken sudo

So I manage to break sudo during this one day of owning MacMini M1. I manage to break sudo during editing /etc/pam.d/sudo. How I can edit it back? I tried using terminal in recovery mode. This file is ...
user avatar
  • 299
1 vote
0 answers
68 views

How to automount an external drive to hold ~/LIbrary[/Developer[/CoreSimulator]]

Xcode simulators as usual multiples and expands turning ~/Library into a dumpster now on 256gb drive there is no space to install xcode 14.2 and i;m thinking to resolve the issue extensively buying an ...
user avatar
1 vote
1 answer
2k views

Why can I not use `sudo` as a `Standard` user in macOS?

I do most of the "work" I do on my Mac as a Standard user (Apple parlance for an unprivileged user). I also frequently use the CLI (zsh mostly now) via the Terminal app. I use MacPorts as a ...
user avatar
  • 3,220
0 votes
1 answer
123 views

How to get access to an admin account without an admin account without losing data

My wife just left me, but changed the password to the admin account on my iMac just to spite me, and I have no way of contacting her. I have a separate managed account for my brother when he was ...
user avatar
0 votes
2 answers
189 views

Why "sudo nano" can bypass csrutil / SIP when enabled and other apps can't?

Initial statement I was installing open source ntfs-3g on my mac (Catalina). At some point, while crsutil was enabled (i.e. System Integrity Protection was on) , I had to modify one line in the ntfs-...
user avatar
  • 19
0 votes
1 answer
321 views

Not even root can `ls .Trashes` on external disk in MacOS

I want to look in the trash directory on an external disk connected to my Mac. db@15 ~ % cd /Volumes/2TB/.Trashes db@15 .Trashes % ls ls: .: Operation not permitted db@15 .Trashes % sudo su Password: ...
user avatar
  • 1
0 votes
1 answer
266 views

anything better than dd to copy disk images to SD card in OS X?

I have used dd because it is what the tutorials suggest to do for instance when copying Linux images to SD cards (e.g. Raspbian, Kali, ...). This is done at 1 Mb/sec on my macbook pro. I have tried to ...
user avatar
  • 379
0 votes
1 answer
342 views

The file system shows there is a user, "_mysql", that I cannot "su" as root. What is basically going on so I can get mysqld running again

The following shell command sequence makes me realize I don't understand something very basic about how user and group accounts works on MacOS: /tmp$ whoami jondoe /tmp$ cd /usr/local/mysql/data /usr/...
user avatar
  • 339
1 vote
1 answer
131 views

Edited Sudoers file and Relocated Items

I had to edit my sudoers file on Sierra or High Sierra (I don't remember which one.) After updating to 10.15, I have the Relocated Items folder and I was able to delete the sudoers but I can't delete ...
user avatar
0 votes
1 answer
706 views

Run an application as another user in Mac

I have tried various methods mentioned across many sites, but cant able to run perfectly on newer versions of mac os. I have tried: sudo -i -u otheruser -H OR sudo login -f otheruser And try running ...
user avatar
0 votes
1 answer
263 views

USERS AND GROUPS advanced options cannot access

I wanted to change my mac's name so I changed the "computer name" in SHARING and also the "account name" and "full name" in USERS & GROUPS. Only thing is I didn't change the "home directory". Now ...
user avatar
2 votes
2 answers
844 views

Blank Sudoers File

I have been trying to set up some stuff for JS, but I need to use sudo. Every time I use sudo, I get this message. >>> /etc/sudoers: syntax error near line 80 <<< >>> /etc/...
user avatar
2 votes
0 answers
709 views

Sudo doesn't work in MacOS Catalina

Since updating to Catalina I haven't been able to do sudo. I'am an admin user, but every attempt to use sudo (such as sudo visudo or sudo vim /etc/sudoers) gives me this message this user is not in ...
user avatar
  • 21
1 vote
0 answers
73 views

How to remove unmounted drive folders from root directory

Recently I have noticed that in the / directory, there were a lot mounted volumes from my old NTFS drive (which I haven't been using for a long time). Several failed attempts to delete them are listed ...
user avatar
10 votes
2 answers
23k views

OS X Catalina: add user to sudoers

Prior to OS X Catalina I could add a user to the sudoers by editing /etc/sudoers with an admin account. With OS X Catalina, I can no longer do this as it seems that Catalina moved to a read-only root ...
user avatar

1
2 3 4 5 6