Questions tagged [sudo]

Used when executing commands as another user.

Filter by
Sorted by
Tagged with
4
votes
1answer
2k views

How do I make a volume mounted using sudo sshfs visible without sudo?

After upgrading my Mac to macOS Sierra (10.12.5), I upgraded FUSE for macOS (https://osxfuse.github.io) to the latest stable releases: FUSE for macOS 3.6.3 and SSHFS 2.5.0. But now this no longer ...
18
votes
3answers
17k views

osascript is not allowed assistive access. (-1728)

Script: #!/usr/bin/osascript tell application "System Preferences" activate set current pane to pane "com.apple.preferences.users" delay 2 tell application "System Events" ...
1
vote
1answer
169 views

Sudo command takes time to run after Sierra

A few days back I updated my iMac from El Capitan to Sierra. I have then noticed that the sudo command is not working properly. When I use something like sudo -v or sudo npm install grunt -g it ...
1
vote
0answers
4k views

Write write to /usr/lib on macOS Sierra

I'm on macOS Sierra 10.12.5, and trying to add a library to the usr/lib folder (for an OpenFrameworks project I'm working on). I've seen similar questions here, here, and here. However, none of the ...
6
votes
3answers
47k views

sudo: command not found

Every time I try to use a sudo or ssh command, it returns with this error: when:~ jackson1442$ sudo [insert any command here] -bash: sudo: command not found I was messing with Python installs, and ...
0
votes
2answers
606 views

removed /etc/hosts on a mac and now can't sudo

I think I made a mistake by editing /etc/hosts within sublime text, because immediately afterward I was unable to run "sudo xxx". It would ask for a password, and then never resolve once I'd typed it ...
1
vote
3answers
3k views

When to use sudo in macOS?

I saw some command line with sudo for using on macOS. I have seen it even used for NPM installs. I am under the impression that using sudo is discouraged for macOS. When do I use sudo in macOS?
10
votes
1answer
4k views

sudo vs su (as non-root user)

My computer has user1 and user2, both administrators. While I'm logged in as user1 I'm trying to: "su - user2" -> prompts me for the users2 password, then I can type commands "sudo --user=user2 [...
1
vote
0answers
2k views

macOS terminal sudo not working

My sudo command is not working. After I type sudo and hit enter (or type sudo with some command and hit enter), the cursor moves to the next line which remains blank. It does not ask my password or ...
3
votes
3answers
3k views

How can I append to a file using dd?

On Linux systems, I can append to a system file like this: echo "# New data" | sudo dd of=/etc/config_file conv=notrunc oflag=append But the dd command under OS X doesn't have the oflag option. Is ...
9
votes
1answer
4k views

Where can I find logs for failed sudo attempts on macOS Sierra?

I am aware that older versions of OS X use secure.log, but I have been unable to find any definite answers as to where the the output log goes for for attempting to run a command with sudo privileges ...
13
votes
4answers
10k views

Why is sudo taking way too long?

I recently updated to macOS Sierra 10.12.4 Beta (16E144f) and it might be what is causing sudo to delay up to 10 minutes as it's the most recent change I recall since this problem occurred. I have ...
1
vote
2answers
2k views

Cannot Run Sudo After Mac Sierra Upgrade

I tried running sudo in a terminal and was greeted with the error message: sudo: unknown uid 501: who are you? I tried doing an ls -l ~, and instead of seeing my user name in the file entries, I saw ...
1
vote
1answer
780 views

Effective uid is not 0, is sudo installed setuid root?

I copied a file named class-dump to my /usr/bin folder, then neither Terminal.app nor iTerm2 work properly on my MacBook. There is something wrong with the sudo command. Here is what I did based on ...
1
vote
1answer
305 views

how to start a mysql server on login

I currently use Valet to develop sites, and many of those sites need SQL databases. To host SQL databases, I run a mariaDB server from the Terminal. In order to start the MySQL server so that I can ...
1
vote
1answer
121 views

Why do I have to use sudo although I'm already a member of wheel?

I like to edit files in my /Library/WebServer/Documents without having to run sudo all the time. So I simply added my username abbood to the wheel group using this command: sudo dseditgroup -o edit -...
3
votes
2answers
23k views

How to turn on “sudo” in OSX 10.12 Sierra

When I type "sudo some_command", the terminal shows: sudo: unable to stat /etc/sudoers: Permission denied sudo: no valid sudoers sources found, quitting sudo: unable to initialize policy plugin my ...
1
vote
2answers
871 views

Running Cron Job w/ Sudo permissions

Strictly for learning purposes (possibly maintenance as well) I am trying to have a Cron job empty my trash once a day. I have opened terminal and entered the command crontab -e to access the VI ...
8
votes
1answer
2k views

Where are sudo insults stored on macOS?

How do I get all sudo insults messages list on macOS?
3
votes
1answer
441 views

Error when using `sudo shutdown` on remote machine

I'm remotely shutting down a bunch of Macs by using ssh to execute the shutdown command on each of them. I've asked the question before (Shutdown "no tty present and no askpass program specified&...
2
votes
1answer
156 views

Grant non-admin sudo privilege, but with `~` being his own home~

I have heard it to be adviced that, with the general idea of least privilege, Unix-like users should create another account without sudo privilege, in addition to the built-in account with sudo ...
0
votes
1answer
4k views

New MBP with Sierra, /usr/local/bin no longer accessible unless root

I just got a brand new MBP with a fresh macOS Sierra install. I installed Elm, which simply puts 5 files in /usr/local/bin. However, when I try to run any of those files, they aren't found: Scotts-...
43
votes
5answers
53k views

Enable sudo without a password on MacOS

My Problem I would like to be able to run sudo commands on MacOS Sierra 10.12 without having to type a password. What have I tried I've read the following: Why does sudo ask for a password in ...
10
votes
1answer
5k views

How do I install sudo insults on Mac?

How do I install sudo insults† on Mac terminal? Apparently Apple has cleaned it up from Darwin, so adding Defaults insults through sudo visudo does not help. † The insulting things sudo command says ...
0
votes
1answer
6k views

Why can't I create a directory under /opt without sudo?

Mac 10.11.5 (El Capitan) here. I just tried creating a directory under /opt: myUser$ mkdir /opt/bupo mkdir: /opt/bupo: Permission denied Why would I need to prefix this with sudo and then ...
1
vote
1answer
344 views

Added myself to /etc/sudoers but sudo still asks for password

This is my /etc/sudoers file edited with visudo, but I'm still asked to enter my password when doing sudo. root ALL=(ALL) ALL %admin ALL=(ALL) NOPASSWD:ALL petruza ALL=(ALL) ALL petruza ALL=(ALL)...
0
votes
1answer
1k views

Sudo askpass not working on macOS Sierra

I use askpass to run commands as root. In file pass.txt I have this written: #!/bin/bash echo mypassword And then I run it like this: export SUDO_ASKPASS=pass.txt ; SUDO_ASKPASS=pass.txt ; sudo -...
3
votes
2answers
11k views

How to remove default GIT or update it?

I cant delete or rename current version of git... Even with sudo... MacBook-Pro-Kiril: $ sudo rm /usr/bin/git override rwxr-xr-x root/wheel restricted,compressed for /usr/bin/git? MacBook-Pro-Kiril:...
0
votes
2answers
1k views

Cannot uninstall git - git clone broken

I cannot clone any repository on my mac anymore. I don't know since when exactly it got broken. $ which git /usr/local/bin/git $ git clone git@bitbucket.org:myaccount/myrep.git Cloning into 'myrep'.....
3
votes
1answer
2k views

User specific host file

I would like to add a user specific host file on my Mac (El Capitan 10.11.5) to a users home directory and have this be checked in addition to /etc/hosts when resolving domain names. I found a ...
1
vote
1answer
946 views

Why can't I create a directory on a mounted USB drive after mkdir, but finder new directory works?

I'm trying to create a directory on a USB3 mounted hard disk drive and it is failing even though the permissions are open: bash-3.2$ ls -al total 0 drwxrwxrwx+ 2 user user 68 Jun 3 18:24 . ...
-1
votes
1answer
85 views

Can naming/running a program “sudo” somehow cause problems?

I hope this is an appropriate place to post this--I have no idea what happened. I named a c++ file (a simple sudoku solver) "sudo.cpp" and then compiled it with "g++ sudo.cpp -o sudo" and ran "./sudo"...
3
votes
3answers
2k views

change sudoers to stop asking for password when running a systemsetup comman

To what exactly do I need to change sudoers file to prevent asking for password when I change system time zone? This is the command I am going to run: sudo systemsetup -settimezone timezone I know ...
11
votes
1answer
17k views

Can't write to /usr even with sudo

Here's my problem: sudo php -d detect_unicode=0 go-pear.phar ...should let me run as root and modify /usr & /usr/share directories, but I get this: Below is a suggested file layout for your ...
7
votes
3answers
3k views

How does the sudo key symbol work?

I'm trying to write a script that requests the user password for some sudo-related commands. My goal is to emulate the default method that OS X uses to obtain the user's password, Password: followed ...
0
votes
2answers
1k views

prevent networksetup from asking for password

I am trying to get rid of password when changing proxy with networksetup. I changed permissions to read and write of /private/etc folder and propagated change to subfolders. I tried this: sudo chmod ...
0
votes
1answer
703 views

I broke sudo - how do I fix it?

Apparently I can't sudo on my Mac any more. Piers-MacBook-Air:~ piersb$ sudo ls Password: Sorry, user piersb is not allowed to execute '/bin/ls' as root on Piers-MacBook-Air.local. Piers-MacBook-Air:...
4
votes
1answer
7k views

How do I fix this sudo permission issue - UID 503, should be 0 - El Capitan

Whenever I try any sudo command whatsoever in terminal, I get the following error message: sudo: /etc/sudoers is owned by uid 503, should be 0 sudo: no valid sudoers sources found, quitting I have ...
1
vote
1answer
139 views

Errors in installing OpenMPI on El Capitan

I'm following this guide to install OpenMPI on my Mac. I think everything is going well, but now I'm at the step where I have to make all. When I try, I get the error Agreeing to the Xcode/iOS license ...
0
votes
1answer
101 views

How do I revert the sudo less /private/etc/cups/printers.conf command?

I have used the above command to try and find my printer's address using the web. Now I would like to revert this setting using terminal. Can anyone help me with this?
1
vote
1answer
68 views

Weird sudo behavior on MacBook Pro

I have a company MacBook Pro. I am sudoer and I can do anything that requires admin privileges when I'm connected to the company network. But I can't when I'm home. How is that possible?
3
votes
2answers
119 views

Sudoers file plist

Using OSX server profiles to configure our fleet of Active Directory connected Macbooks. When our laptops are not connected to the internal network (or via VPN), their AD group membership is lost. ...
-1
votes
2answers
430 views

su and sudo without typing passphrase twice

On the command line, I find that, if I want to administer something, I must first login admin and enter password and then sudo something and enter password again. Is there a way to do this in one step,...
1
vote
0answers
122 views

Getting bash-3.2 everytime I “su”

Whenever I su, PS1 changes to \s-\v\$. Why is that? Tried setting it, but it still changes when I su again, or exit the terminal. What to do?
4
votes
2answers
173 views

Allowing sudo privileges, but not access to sites

Is it possible to make it so a user can use the sudo command in terminal, but not have access to sites other then those allowed through parental controls, without a third party system?
1
vote
3answers
1k views

None of my admin accounts are sudo users

I have three admin accounts on one machine running El Capitan. The machine is a few days old. Whenever I try to run a sudo command, I'm asked for my password and told accountUsername is not in the ...
2
votes
1answer
3k views

Operation not permitted “sudo ditto -v to folder /usr/bin”

I'm trying to copy an exec file from my downloads folder to /usr/bin/ using sudo ditto -v sweep /usr/bin/sweep, but the command always fails in Terminal. I even tried to manually drag and drop it but ...
0
votes
1answer
71 views

How do I grant irrevocable privacy from user with sudo access?

In Unix, any user with sudo access can act as any other user using sudo su. This invalidates any imagined privacy of local files for all other users of the same Mac. Is there any (preferably OS-level) ...
2
votes
1answer
3k views

How to install ruby gems without sudo

I want to install a Ruby Gem to my computer, but since I don't have an administrator account I can't use sudo. How do I install a Gem without sudo, and what (if any) privileges do I loose? This is in ...
25
votes
1answer
83k views

Can't write to /usr/lib

I upgraded to OS X El Capitan and tried to install a new app (MPLAB X from Microchip) but I got an error because it couldn't copy a library to /usr/lib even when it asked for root password. I tried to ...