Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Hot answers tagged

66

sudo can do just that for you :) It needs a bit of configuration though, but once done you would only do this: sudo -u user2 -s And you would be logged in as user2 without entering a password. Configuration To configure sudo, you must edit its configuration file via: visudo. Note: this command will open the configuration using the vi text editor, if you ...


36

sudo passwd root Enter YOUR password and you're in.


28

The terminal doesn't show the characters being entered when typing in a password field such as a sudo password field. The characters are still being entered—just type your password as normal and press Enter to continue. $ sudo echo hi Password: type here, then enter hi You can show asterisks when entering your password for sudo by editing the sudoers file. ...


28

It is a new feature of OS X 10.11 (El Capitan): SIP. System Integrity Protection (SIP,1 sometimes referred to as rootless2) is a security feature of OS X El Capitan, the operating system by Apple Inc. ... Among the protected locations are: /System, /bin, /sbin and /usr (but not /usr/local). System Integrity Protection on Wikipedia It can be disabled:...


27

Open a terminal, run sudo visudo Edit the line: %admin ALL=(ALL) ALL To say: %admin ALL=(ALL) NOPASSWD: ALL Now, you should now be able to run sudo without password.


24

The event will be logged in /var/log/secure.log and a mail will be sent to root (which by default goes to /dev/null which is Unix speak for it is discarded).


20

This is expected behaviour. The purpose of su is to switch user. It's called the substitute user identity tool. su takes the other user's password since you are switching to that user. The su utility requests appropriate user credentials via PAM and switches to that user ID (the default user is the superuser). A shell is then executed. Source: Man page ...


17

The group entry %admin ALL=(ALL) ALL seems to override the user specific entry. I found moving the user specific entry so that is appears after the group entry fixes this. Maybe sudo parses the entire file and it uses the last matching entry? Changing your sudoers file to something similar to below should work. # User privilege specification root ALL=...


16

This is standard behaviour for a Mac, even if the user is in the Administrators group. The password is that of your user account, not the root account (which is typically disabled by default). OS X asks for your password in a number of situations, not just when using sudo. If you've forgotten your user account password, you can reset it following Apple's ...


15

f you store your CA certificates on the filesystem (in PEM format) you can tell curl to use them with sudo curl --cacert /path/to/cacert.pem ... You can also turn off the certificate verification with sudo curl --insecure ... Edit: Updated with regard to feedback If you want to set this permanently, you should create a .curlrc files and place in your ...


15

You can boot into single user mode by pressing Cmd-S on startup (see OS X: How to start up in single-user or verbose mode for details) which should give you a root shell. Then run mount -uw / chown root:wheel /etc/sudoers chmod 440 /etc/sudoers reboot to fix the problem and restart.


14

You can add a line like %admin ALL = !/bin/rm -rf / to your sudoers file to prevent the execution of the command with the specific options. Or, if you want to exclude several commands, you can work with command aliases Cmnd_Alias DANGEROUS_CMNDS=/bin/rm -rf /, /bin/rm -fr / %admin ALL=!DANGEROUS_CMNDS You can also try to play it safe by using ...


14

You are trying to install in /usr which is protected by SIP (System Integrity Protection), a feature introduced with 10.11 (see What is the "rootless" feature in El Capitan, really? for details). Use /usr/local instead, which is the location intended for user-side installations.


13

OS X has not turned ON as many completion possibilities at the guys behind Ubuntu. In order to add autocompletion to sudo, you should simply add to the file $HOME/.bash_profile complete -cf sudo The description of complete and its options is briefly defined in the bash built-in commands manual page (see man bash). Although the -c and -f commands are not ...


13

To install a sudo with insults you have to compile it yourself: Requirements: Xcode 8.0, Sierra 10.12, probably SIP disabled Backup sudo and visudo: sudo cp /usr/bin/sudo /usr/bin/sudo.backup sudo cp /usr/sbin/visudo /usr/sbin/visudo.backup Create a dir: mkdir sudo Change to the directory: cd sudo Curl the Apple open source sudo: curl https://...


12

$PATH should contain these folders: /usr/bin:/usr/sbin:/bin:/sbin. Try editing ~/.bash_profile, ~/.profile, or ~/.bash_login (with for example /usr/bin/open ~/.bash_profile -a TextEdit) and commenting out any lines that modify the path. If that works, you can add a line like export PATH=/opt/local/bin:/opt/local/sbin:$PATH to ~/.bash_profile.


11

If you run sudo strings /usr/bin/sudo you get (among a lot of other things) Sudo version %s 1.8.17p1 Configure options: %s --with-password-timeout=0 --disable-setreuid --with-env-editor --with-pam --with-libraries=bsm --with-noexec=no --sysconfdir=/private/etc --without-lecture --enable-static-sudoers --with-rundir=/var/db/sudo For insults to be included, -...


11

ErikMH's answer gave me the idea to first just try to revert the sudoers file, without reverting/upgrading my whole system again. So in short: Run this to get a root shell: sudo -s Make a copy of /private/etc/sudoers Run: cp /private/etc/sudoers\~orig /private/etc/sudoers Fix permissions by running: chmod 440 /private/etc/sudoers ; chown root:wheel /private/...


11

If you run AppleScript code via osascript in Terminal, then you need to add Terminal to System Preferences > Security & Privacy > Privacy > Accessibility, to allow it assistive access. I took your code, saved it to a file named testcode and made it executable using chmod. I then ran it in Terminal and received the following error: ./testcode:157:286: ...


10

sudo requires a password by default on Mac OS X. Apple's knowledge base article explains more, Mac OS X: sudo command requires a non-blank admin password: In Mac OS X v10.5 through 10.5.8, if you press the Return key at the password prompt without entering a password (even if the user has no password, which is not recommended), the command entered ...


10

sudo exclusively uses account names, not the user's full name. As a hint, account names don't contain spaces, so "Syammala Naidu" is not correct. To find out a user's account name: Open System Preferences. Select Users & Groups. If necessary, click the lock on the bottom left corner of the window and type an administrator's name and password to unlock ...


10

.dmg is not an app, it is a disk image. If you double-click the file, it should mount a virtual disk in the Finder. From there, you will be able to drag and drop the image into your applications folder. Since you don't have admin rights on the computer you're using, you'll need to drag it into your user Applications folder (/Users/yourname/Applications/, ...


9

If you have an administrator user account set up on your Mac in addition to the root account, you can use the Directory Utility to do the following: Open the Directory Utility from /System/Library/CoreServices or in OS X 10.11 and later, System/Library/CoreServices/Applications. Click the lock button and authenticate as an administrator: Go to the menu ...


9

Rather than give geoff sudo privileges, consider adding the account to the admin group so that it inherits the admin group sudoer privileges. This would be the more correct way to do things. To add geoff to the admin group you'll need to run the following as the admin account: sudo dseditgroup -o edit -a geoff -t user admin You may also want to consider ...


9

Your PATH is hosed! First check your .bash_profile file with: /usr/bin/nano ~/.bash_profile Prepend lines containing something like export PATH="/... " with a # to comment them out. Save the file with ctrlO and exit nano with ctrlX Then check /etc/paths with: /bin/cat /etc/paths. It should look like this: /usr/local/bin /usr/bin /bin /usr/sbin /sbin ...


8

To add a user to sudoers, as admin do sudo visudo Then scroll down to # User privilege specification root ALL=(ALL) ALL %admin ALL=(ALL) ALL place the cursor at the next (empty) line, and press a (for append). Then type shortname ALL=(ALL) ALL where shortname is the short name for the user that you are adding to sudoers (there should be TAB ...


8

Changing the permissions on /private/etc/sudoers is definitely a no-no. The sudo command will fail to work if that file's permissions are not 0440 as you are noticing. This is a security measure -- the command distrusts any permission setting that is less restrictive than 0440 as it allows for potential tampering with sudo permissions on the box. Normally ...


8

Yes, it is possible. Edit the sudoers file by typing the following at the command prompt: sudo visudo Find the section commented with # Defaults specification and look for a line like this: Defaults env_reset Change that line to: Defaults env_reset,timestamp_timeout=10 Where you can replace 10 with whatever the number of minutes you'd like for the ...


8

I get the key symbol when running read -s in Terminal. As this seems to work the same for read -s as for sudo, I assume this is a feature of Terminal (to display a key symbol whenever input is requested in silent/hidden mode).


Only top voted, non community-wiki answers of a minimum length are eligible