execute a command as another user

learn more… | top users | synonyms

17
votes
4answers
11k views

Where will the incident with the sudo command be reported to?

If a non-admin types a sudo command in Terminal, this will appear after they enter their password: User is not in the sudoers file. This incident will be reported. Where is this reported to?
14
votes
2answers
43k views

allow sudo to another user without password

I want to be able to 'su' to a specific user, allowing me to run any command without a password being entered. For example: If my login were user1 and the user I want to 'su' to is user2: I would ...
11
votes
4answers
8k views

Can sudo's annoying message be removed from Mountain Lion 10.8.0?

After the upgrade to 10.8.0, whenever I do a sudo, I always get this message: dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid I have ...
10
votes
2answers
1k views

How to prevent 'sudo rm -rf /'

A few times I have accidentally executed the command sudo rm -rf /. Is there a way how to prevent me from running this command? For example can I somehow disable it using the sudoers file?
9
votes
3answers
141k views

How do I run terminal in sudo mode?

I was trying to install npm, and I got npm ERR! Error: EACCES, Permission denied '/usr/local/lib/node_modules' npm ERR! npm ERR! Please use 'sudo' or log in as root to run this command. npm ERR! ...
8
votes
6answers
26k views

How do I open a file as root in TextEdit on Lion?

How do I open a file as root, in TextEdit? I've tried these commands as root, but TextEdit always say it's locked: open -e /etc/apache2/httpd.conf open -e -F /etc/apache2/httpd.conf open -e -F -W ...
8
votes
3answers
245 views

Is it possible to extend the time i'm logged as administrator when enter sudo mode from the console?

Is it possible to extend the time i'm logged as administrator when enter sudo mode from the console? If yes, how?
6
votes
6answers
16k views

How to fix curl: (60) SSL certificate: Invalid certificate chain when using sudo

So since the Mavericks upgrade curl has more issues with certificates. When trying to curl a file from my web server with it's self-signed certificate it was getting the error "SSL Certificate: ...
6
votes
1answer
7k views

Sudo keeps asking for password, despite that NOPASSWD already set

The following sudoers configuration used to work well in MacOS 10.8.5, several days ago I upgraded to Mavericks, NOPASSWD flag does not seem to work anymore: # User privilege specification root ...
5
votes
2answers
15k views

Why can't I run `su`? (and how should I do?)

Whenever I try to issue su I get this: $ su Password: su: Sorry Needless to say, I'm entering the correct admin password which does work with sudo. What I want is not having to enter sudo each ...
5
votes
3answers
1k views

After typing sudo I can no longer autocomplete commands by pressing Tab

In a Terminal, if I type beginning of any command by pressing tab I can see the rest of that command. However this feature does not work with any words I type after sudo. How can I complete command ...
5
votes
2answers
2k views

Can sudo use my existing aliases?

How can I let sudo use my existing aliases in my .bash_profile (or .bashrc, .profile …)? For example I want to be able to use ll instead of ls -laGF as sudo.
4
votes
5answers
44k views

How do I reset/recover my superuser password without the boot disk?

I lost the superuser password for my iMac and I don't have the boot disk. I already tried the second answer on this page, but every time I type su from the command prompt, it still asks for a ...
4
votes
2answers
24k views

terminal sudo or su asks for password in Mountain Lion OS X

I don't know the root password on my system and I'm trying to start Apache. $ sudo apachectl start WARNING: Improper use of the sudo command could lead to data loss or the deletion of important ...
4
votes
2answers
5k views

Installing Homebrew on Lion

I am trying to install Homebrew on Lion but keep getting an error. $ /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)" I run the above code, which results in: ==> This script ...
4
votes
2answers
3k views

How can I specify shutdown time with “sudo shutdown”?

In the following Terminal command sudo shutdown -r now, there is a time set ("...now"). Is there a way to set a specific time. For example, could it be sudo shutdown -r -int 1200?
4
votes
1answer
3k views

whoami is not who I am!

I login into my own computer as username geoff. When I open a terminal I have as prompt: Geoffs-MacBook-Air:~ org1$ The org1 is my work username! I have no login of that username for this computer ...
3
votes
2answers
16k views

How to specify command to always run as root?

In Mountain Lion, I frequently used a simple automator app called "Purge Memory" which just ran "purge" in the command line. I really enjoyed cleaning the RAM, especially when buggy apps ran memory ...
3
votes
2answers
14k views

How do I give a user sudo permissions?

On my computer I have two accounts: geoff and admin. I want to do gacutil.... Doing it in account geoff (where I need it to be done) I get the message: gac directories could not be created, possibly ...
3
votes
2answers
13k views

Terminal returns not found for most commands Mac OSX

I'm really new to Mac OSX and UNIX based systems. I wanted to run a few Windows games on my Mac Mini so I started installing Wine and MacPorts. Having done so, I typed in sudo port install wine and ...
3
votes
1answer
911 views

Changing read permissions on /private/etc recursively

I was trying to make my /private/etc folder and all its contents world-readable. 'Permission denied' messages from a number of internal files and folders were a recurrent theme whenever I did a find ...
3
votes
3answers
5k views

How can I execute sudo commands as a cron job?

I'm trying to execute a shell script as a cron job. The problem is that my script needs to be run as a super user. I tried it with just writing sudo infront of the command in my crontab file, but it ...
3
votes
1answer
697 views

dyld message when launching commands as sudo

When I launch a command from the shell as super user I always get back the following message: dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or ...
3
votes
1answer
3k views

How to avoid the GUI password prompt when using `osascript`?

I’d like to use the osascript shell command to run some AppleScript, but I’d rather avoid the GUI password prompt. Instead, I’d prefer to run the script as sudo from the command-line, so no GUI ...
2
votes
3answers
4k views

Why does sudo ask for a password in terminal?

Why does sudo ask for a password when one can sudo su without a password and perform the same commands? Is there a way to make sudo not ask for a password when you're logged in as the an admin anyway? ...
2
votes
2answers
16k views

Sudo password doesn't work even if I have no password

I've erased the password from preferencenow I can log in without using any password but when I run a sudocommand terminal ask me a password if I insert nothing or the old one it return error. What's ...
2
votes
4answers
825 views

Run GUI Applications from Terminal with root privilege

So it has been well documented that GUI applications (like gedit or textedit) should NOT be run with sudo. Ubuntu et al get gksu and gksudo (and the like) so question: what do WE (Mac users) get? ...
2
votes
1answer
221 views

Super and admin user in OS X

Superuser account is disabled by default in OS X (Mavericks). But if you run sudo -l you will come to know that the admin user can execute all superuser commands. Then what is the point of disabling ...
2
votes
2answers
2k views

Homebrew / link osxfuse not possible

I didn't run brew doctor since a lot of time. Know it tell me I should run brew link osxfuse. Here I show you the rest: Newton:~$ brew link --overwrite osxfuse Warning: Could not link osxfuse. ...
2
votes
3answers
8k views

How do I run sudo command from standard account?

From what I've read, it is good security approach to have two accounts, one admin and one standard. I am trying to run the following command in terminal on my standard account sudo mv ...
2
votes
1answer
474 views

How can root launch a regular Mac application from a cron job in /etc/crontab?

I want the cronjob to do some things as the superuser, and depending on the result, launch an app as me, the logged-in user. I've tried a bunch of things but nothing I think should work does. ...
2
votes
2answers
3k views

User changed to 502 on OSX

I have a small problem with my permissions. I use rsync frequently on a certain target directory, but one day I by accident I used "sudo rsync", and now all my permissions for the files in the ...
2
votes
0answers
74 views

What is a reasonable command to prompt for sudo password with sudo -A?

My question is definitely related to What option should I give the sudo command to have the password asked through a graphical interface? But my question is slightly different. I know how to use sudo ...
1
vote
2answers
179 views

Mac OS X administrator account still requires sudo

when trying to install Ruby, Vagrant, and Grunt using terminal I am still required to use sudo on my installs. I am sole proprietor of the laptop and have an administrator account. Shouldn't I be able ...
1
vote
1answer
71 views

sudo asking for password even though user doesn't have a password set

I have a computer that doesn't not require a password. I'd like this to continue into sudo, but unfortunately it doesn't recognise a user not having a password. According to Apple the sudo command ...
1
vote
3answers
1k views

sudo: /etc/sudoers is owned by uid 501, should be 0

To run programs as sudo without password, I edited /etc/sudoers with wrong content. Then I re-edited it with Mac's default text editor(course sudo cannot be used when /etc/sudoers is wrong). I ...
1
vote
2answers
807 views

Installing / removing encfs

I'm trying to install encfs, for which I need brew. I installed brew, but installing encfs is a pain. bash-3.2$ brew install osxfuse Warning: osxfuse-2.6.2 already installed, it's just not linked ...
1
vote
2answers
106 views

Change root password to be different than Admin password

I want to change the root password so it is different than the admin password. I need to change the password so the admin can still be logged on, but the root password to modify the hosts file ...
1
vote
2answers
737 views

Password problems changing users in Terminal

I'd like to switch between the default user in Terminal and the user 'postgres', created when I installed PostgreSQL 9.2. If I type su postgres, I'm prompted for a password that I don't know and ...
1
vote
1answer
95 views

Sudo with Sidekick

Sidekick is a helpful little tool which adjusts the system settings based on geographical location. I added an action which will execute a sudo command-line command. The problem is that the Terminal ...
1
vote
1answer
8k views

su & sudo on OSX Mavericks

I am trying to use su and sudo on my iMac that I did a fresh clean install of Mac OS X 10.9 and Server 3.0. I explicitly set the password for root with passwd root but when I try to use su or sudo ...
1
vote
2answers
406 views

Is there a way to set an Application Shortcut in the Keyboard Preference Pane via Terminal?

I'd like to have a bootstrap for my custom keyboard shortcuts to use on multiple machines...
1
vote
3answers
1k views

How do I schedule a root command to run at intervals?

I need to run a script in intervals that requires a root user to execute. I created a plist that will call a script in ~/bin/test.sh. user@MBP:~$ ls -lah ~/bin/ -rw-r--r-- 1 root staff 566B ...
1
vote
1answer
264 views

How do I run BeyondCompare in X11 as root?

I used WineBottler to install Beyond Compare on my Mac. It runs within an X11 environment. (It works great, by the way.) But it cannot access many folders to which my user account does not have ...
1
vote
1answer
708 views

sudo password incorrect all of a sudden

sudo ls All of a sudden it says password incorrect. I am 100% sure of my password. I don't know what happened. Hacked ?
1
vote
0answers
44 views

Terminal 3 failed password attempts

I've got a really funny issue with my Mac at the moment. I was using a sudo command and it rejected my password 3 times (I double checked and the password was correct) but now I can't do anything as ...
1
vote
2answers
2k views

How to open a shell script in a new Terminal window and run it with administrator privileges

I need to programmatically open a shell script in a Terminal window and run it with administrator privileges. I'm using osascript as it displays a convenient prompt for an admin login/password. I'm ...
1
vote
1answer
28 views

Access to sudo but not security and privacy or users and groups

How can I add myself to these groups so that I can have access to these areas in system preferences? I have sudo access but I'm not sure how to accomplish this through terminal.
1
vote
1answer
63 views

Rsync fails due to Sudo timeout

I am trying to run a lengthy Rsync (local machine only, no ssh, no lan or wan connects involved) but Sudo is timing out and the script fails. Total runtime of the command is about 20 mins. What is the ...
1
vote
2answers
72 views

Unable to start computer after using sudo crontab -e

I've set it so that my Mac will forcefully shutdown at 12:00 everyday. But I try to turn it back on, it shuts down again right after.