Terminal automatically executes sudo command on opening?

I am running Lion 10.7.5. I tried to execute a sudo command but remembered i did not have sudo privleges on my account so i logged onto the root user and executed it there. Getting back on my regular account i opened terminal but it automatically executed the sudo command again and if i exceeded the password attemp limit it just re executed the command and looped infinently. I now cannot use terminal on my account. I have deleted com.apple.Terminal.plist from its location and still nothing.

Did you accidentally put a sudo command into one of the following files?
.bash_profile
.bash_login
.profile
.bashrc
Or does one of the above files run a script that tries to execute sudo?
If you cannot get a command prompt you can use Terminal -> Shell -> New Command to issue one command at a time.
Message was edited by: BobHarris

Similar Messages

  • Trouble Executing Sudo Commands

    I am trying to execute a sudo command on the terminal, everytime I try to do it it asks me for my password but when I attempt to type it in nothing happens (it does not even type it). Does anybody know why this is happening and how to fix it?
    Thanks!

    JavaFan2 wrote:
    In fact, I help supervising a student project who is supposed to write an admin application to offert graphical interfaces for some security and system tools under Linux (like fdisk, iptables etc) using J2EE, ... something like Webmin.
    As I said, I know that is has a huge security risk but this app has the only purpose of learning J2EE, no security issues are treated.If you want to say "I will leave my office door open because there's no security risk in doing that" then that's a valid statement. But what you are trying to do here isn't the equivalent of leaving your office door open. It's the equivalent of finding a master key for all the offices in the world. And as such it is in fact a serious security risk which should not be circumvented.
    And no, it's no good saying "But I'm only going to use this all-powerful master key to open my own office door". If you get the key then anybody else can get the key too.

  • Error executing sudo command

    When I try to execute a sudo command I get the following message:
    "sudo: /etc/sudoers is mode 0644, should be 0440
    Segmentation fault"
    What does it mean?
    Thanks for all the help.

    When I try to execute a sudo command I get the following message:
    "sudo: /etc/sudoers is mode 0644, should be 0440
    Segmentation fault"
    What does it mean?
    It means someone has incorrectly modified the /etc/sudoers file, and as a side effect its permissions were changed to an insecure form, so sudo refuses to use the file. It is also possible that the /etc/sudoers file syntax is also invalid, which might also cause the segmentation fault.
    'visudo' should be used to edit the /etc/sudoers file, which would have properly preserved the permissions, as well as verified that the updated /etc/sudoers file contained valid syntax so that sudo would continue to work. See 'man visudo'.
    You now have a problem, in that you can no longer use sudo to fix the permissions.
    You should first try booting your installation DVD. Via the Menu, you can run Disk Utility and run Repair Permissions. Hopefully this will repair the /etc/sudoers file. You could try running Applications -> Utilities -> Disk Utility, however, if it wants to use sudo to elevate its privileges, that would fail, as a broken /etc/sudoers file is still a broken /etc/sudoers file.
    If you have by any chance enabled the 'root' account, you could try logging in as root and fixing the /etc/sudoers file's permissions.
    You should also run visudo, so that the file's syntax is valid.
    I think you can use the Installation DVD to enable the root account. that might be another way to login as root.
    If repair permissions does not work, then maybe you can put your Mac into firewire target mode, mount your Mac's disk on another Mac via firewire, and repair the /Volume/Macintosh HD/etc/sudoers permissions from the working Mac.
    If that failes, the next step is booting your Mac in Single User mode. Search for "Single User Mode" in the forums, and you should find instructions on both booting, as well as how to make the root file system writable so you can change the permissions from single user mode.
    And if that does not work, I think you are left with reinstalling the OS.
    Message was edited by: BobHarris

  • Execute a command in an external program.

    Hi all,
    I have a little question. I want to execute a command (ctrl+F1) in an external program. This program is already open, so i dont need to execute it. Is there a way to get the focus in this program and automaticly execute my command? I have checked around and all i found was how to execute the program.
    Thanks alot
    Alex

    I want to execute a command (ctrl+F1)Thats a key stroke, not a command.
    in an external program.I always ask this, but what is an internal program?
    Is there a way to get the focus in this program and automaticly execute my command?Kind of. java.awt.Robot provides methods to simulate mouse and keyboard events. If you know where the window is on the screen, you could focus it using the Robot (move the mouse over it and click) and then issue a key event.
    Not too easy.

  • Can't open .term Terminal.app files from command line

    Howdy. I use Terminal.app constantly for ssh'ing into numerous remote machines. On my G4 Powerbook I have simply created .term files with customized colors, titlebars, and an appropriate ssh execution string for each machine/userid combination, which I am able to open with "open ~/bin/foo.term". Life is no longer so joyously simple on my new Intel iMac. I create a .term file (via Cmd-s while in a terminal window), but the above command to open foo.term now simply doesn't work on my iMac once a single terminal window has been opened (even after it's been closed) -- I can start one such file only from the finder or via Launchbar or Quicksilver. The only way I can use my .term files is by switching to Terminal and selecting File...Open and clicking on the .term file -- which, being a command line (and Launchbar) junkie, I hate, of course. Applescripts don't work either.
    I would be forever grateful if someone could tell me how to fix this problem!
    txlogic
    Intel iMac Mac OS X (10.4.6)
    iMac   Mac OS X (10.4.6)  

    TXLogic
    I cannot do it either.
    Ah, interesting -- thanks for the input. I had thought the problem might have something to do with the fact that I was using an Intel iMac, but you are using a PPC iBook. The problem isn't with 10.4.6 either, as that is what I'm running on my G4 Powerbook, and the .term files work as expected on that machine.
    Initially I thought it was a
    problem with permissions, i.e the term file hadn't
    the execute bit set (which it did not). Setting the x
    bit though did not help at all.
    Right, the .term files aren't executable.
    A work around was to
    save the command(s) into a plain text document in
    text edit (not rtf) as a .command file (no txt
    extension in this case) and set its execute bit in
    terminal (sudo chmod u+x ...).
    I don't quite understand the workaround -- what command(s) exactly did you put into the .command file? Could you paste the contents of such a file here?
    I have not dealt with term files extensively but I
    noticed that .term files are xml ones. Could anyone
    shed some light in possible changes in the way
    terminal handles them?
    Since the .term files work as desired on my Powerbook, it now doesn't appear that Terminal.app has changed its processing of the files. Something else is going on here.
    txlogic

  • Terminal doesn't understand sudo command

    I am installing MacPorts 1.7.0 from a .dmg file. Following, I set up the environment variables in the .profile file, and tried to use Terminal to update using the sudo port selfupdate command from Terminal.
    This is the result I got:
    -bash: sudo: command not found
    Why is this, and what can I do?

    I think the error refers to the command(s) following "sudo." Were you prompted for your password?
    No, that would be:
    sudo fred
    Password:
    sudo: fred: command not found
    But if the command bash is asked to execute is not found you get
    fred
    -bash: fred: command not found
    So I think he is not finding sudo.
    That makes me think that PATH has been messed up, because sudo is in /usr/bin/sudo which is always in PATH unless it has been messed up. Which makes me think that .profile was properly executed, and that is how PATH got messed up.
    So I would look very closely at .profile and make sure PATH is setup correctly. I would expect it to looks something like:
    export PATH="$PATH:/opt/local/bin"

  • After typing a sudo command on terminal how do you save it so you dont have to keep giving that same command every time I restart my mac??

    I have a 45mb/s internet at home and my youtube videos load extremely slow, after reading many blogs and empting my cache cleaning my history I stumble across a post that told me i had to block two IP's on the terminal using this two commands: " sudo ipfw add reject src-ip 173.194.55.0/24 in" and "sudo ipfw add reject src-ip 206.111.0.0/16 in" that it should help. After I did that and restarted the mac those commads are undone. Is there a way to save thos commands tipped in the terminal??

    Open the AppleScript Editor in the /Applications/Utilities/ folder and paste in the following:
    set thepass to text returned of (display dialog "Your administrator password is needed." default answer "" buttons {"Cancel", "OK"} default button "OK")
    do shell script "ipfw add reject src-ip 173.194.55.0/24 in" password thepass with administrator privileges
    do shell script "ipfw add reject src-ip 206.111.0.0/16 in" password thepass with administrator privileges
    Save it as an application and add it to the list of login items for your user account in the Users & Groups pane of System Preferences.
    (81466)

  • Executing sudo linux commands through a JSP page.

    Hi,
    I need to execute some superuser commands through a JSP page under Linux.
    I added users apache and tomcat to the /etc/sudoers file with no password prompting.
    My JSP page works fine with any usual linux command, but when I call a “sudo cmd” I have a message (when reading the ErrorStream instead of the InputStream) that “sudo can’t be executed because it needs a tty” even when I call the shell before the sudo command.
    Here is a piece of my code (very basic):
    String cmd="linux_cmd";
    Process proc = Runtime.getRuntime().exec(cmd);
    InputStream stdin = proc.getInputStream();
    InputStreamReader isr = new InputStreamReader(stdin);
    BufferedReader br = new BufferedReader(isr);
    String line = null;
    while ( (line = br.readLine()) != null)
    out.println(line);
    Is there any way I can make sudo calls from a JSP page ?
    I know that making root calls from a web application is a bad thing, but for now security is not my concern.
    Thank you for any tips.

    JavaFan2 wrote:
    In fact, I help supervising a student project who is supposed to write an admin application to offert graphical interfaces for some security and system tools under Linux (like fdisk, iptables etc) using J2EE, ... something like Webmin.
    As I said, I know that is has a huge security risk but this app has the only purpose of learning J2EE, no security issues are treated.If you want to say "I will leave my office door open because there's no security risk in doing that" then that's a valid statement. But what you are trying to do here isn't the equivalent of leaving your office door open. It's the equivalent of finding a master key for all the offices in the world. And as such it is in fact a serious security risk which should not be circumvented.
    And no, it's no good saying "But I'm only going to use this all-powerful master key to open my own office door". If you get the key then anybody else can get the key too.

  • Using Automater to run Terminal and enter a command

    I am currently interested in using a script or the automator to open Terminal and enter a specific command line I use to authenticate on my university network. Frankly I'm getting tired of typing that command line in so often.
    However, I am relatively new to apple, and I'm not very familiar with scripting. If someone could give some suggestions that would be great.

    Open the Script Editor in the /Applications/AppleScript/ folder and type in the following:
    do shell script "your command"
    Save this script as an application and place it on the desktop for easy access. If the command requires the use of sudo, the needed syntax is:
    do shell script "your command" password "yourpass" with administrator privileges
    The actual phrase 'sudo ' isn't necessary in do shell script unless you will be passing sudo a flag. If the command needs interaction, use the following:
    tell application "Terminal"
    do script "your command"
    end tell
    This implementation requires the use of sudo for root authentication.
    (20272)

  • Applescript for running sudo commands in terminal

    I'm a newbie when it comes to Applescript and was wondering if someone could help with a basic request. I need to write a small script to do the following:
    1. Launch terminal
    2. Run the 'Sudo -s' command
    3. Enter the administrator password (in plain text)
    and then
    4. run some sudo commands like "sudo defaults write /Library/Preferences/com.apple.loginwindow HiddenUsersList -array-add administrator"
    I actually WANT the administrator password to be in the script in plain text even though I understand the security risks (I will literally be the only person to ever see the script). I've trawled forums all over but can't seem to find what I am looking for and cannot get it working by patching together the various commands I have found. Thanks in advance for any help you can give!
    Sean

    I've included two examples.  The preferred way & the hacker way.
    with administrator
    It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on.  Here is an example.
        Author: rccharles
        For testing, run in the Script Editor.
          1) Click on the Event Log tab to see the output from the log statement
          2) Click on Run
        For running shell commands see:
        http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html
    on run
        -- Write a message into the event log.
        log "  --- Starting on " & ((current date) as string) & " --- "
        --  debug lines
        set unixDesktopPath to POSIX path of "/System/Library/User Template/"
        log "unixDesktopPath = " & unixDesktopPath
        set quotedUnixDesktopPath to quoted form of unixDesktopPath
        log "quoted form is " & quotedUnixDesktopPath
        try
            set fromUnix to do shell script "sudo ls -l  " & quotedUnixDesktopPath with administrator privileges
            display dialog "ls -l of " & quotedUnixDesktopPath & return & fromUnix
        on error errMsg
            log "ls -l error..." & errMsg
        end try
    end run
    This version has an inline password.
    Notice the echo 'password' |
    The single quotes are no accident.
    It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on.  Here is an example.
        Author: rccharles
        For testing, run in the Script Editor.
          1) Click on the Event Log tab to see the output from the log statement
          2) Click on Run
        For running shell commands see:
        http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html
    on run
        -- Write a message into the event log.
        log "  --- Starting on " & ((current date) as string) & " --- "
        --  debug lines
        set unixDesktopPath to POSIX path of "/System/Library/User Template/"
        log "unixDesktopPath = " & unixDesktopPath
        set quotedUnixDesktopPath to quoted form of unixDesktopPath
        log "quoted form is " & quotedUnixDesktopPath
        try
            set fromUnix to do shell script "echo 'password' | sudo ls -l  " & quotedUnixDesktopPath
            display dialog "ls -l of " & quotedUnixDesktopPath & return & fromUnix
        on error errMsg
            log "ls -l error..." & errMsg
        end try
    end run

  • I am trying to install oracle 11g xe on ubuntu aws instance when i execute sudo /etc/init.d/oracle-xe configure command iam getting this error: sudo: /etc/init.d/oracle-xe : command not found

    i am trying to install oracle 11g xe on ubuntu aws instance when i execute sudo /etc/init.d/oracle-xe configure command iam getting this error: sudo: /etc/init.d/oracle-xe : command not found.

    "command not found" means ... there is no such thing.
    Has the .rpm been installed?
    http://docs.oracle.com/cd/E17781_01/install.112/e18802/toc.htm#XEINL122

  • Isight not working anymore after a sudo command i put on terminal

    i have not been able to get the smc to work.. but i am almost positive what the problem is that sudo command killall for coremedia command i did..b ecause not my isight built in camera will not work for any application.// this has me freaking out.. please if anyone could guide me through whatever it takes to get this isight camera working that would be a life saver.. i do not believe that it is hard ware because it was working just fine that entire day until i did something in terminal trying to stop the coremedia processes not knowing what they were..

    Post the exact command you entered in terminal.
    You can copy and paste the single command from the output of:
    history

  • What is the terminal command to open sound preferences in Mac Snow Leopard

    Hi
    I want to know what is the command to open sound preferences dialog from command prompt.
    short key for doing this is option key + F12. But I am looking for somehting I can enter in terminal to open sound preferences.

    Get under the hood with Command Line and the Terminal. Unix forum is here for fast answer:
    http://discussions.apple.com/forum.jspa?forumID=735

  • I want to disable 'Spotlight' for repairing my disk "Macintosh HD" , but somehow the command 'sudo mdutil -a -i off' does not work in 'Terminal'. I get result as ' bash: sudo: command not found' .I am using OS 10.10.  Please help.

    I want to disable 'Spotlight' for repairing my disk "Macintosh HD" , but somehow the command 'sudo mdutil -a -i off' does not work in 'Terminal'. I get result as ' bash: sudo: command not found' .I am using OS 10.10.  Please help.

    It appears that you may not have a properly installed OS X system.
    You must be connected to the Internet to reinstall OS X.
    In the menu bar, choose Apple menu > Restart. Once your Mac restarts (and the gray screen appears), hold down the Command (⌘) and R keys.
    Select “Disk Utility,” and then click Continue.
    Select your startup disk from the list on the left, and then Repair Disk.
    After disk is repaired, select Reinstall OS X, then click Continue.
    Follow the onscreen instructions. In the pane where you select a disk, select your current OS X disk

  • When I open the Adobe Acrobat, Can I execute my command?

    Hi to all, my plug-in execute my command when I clicked my ToolButton, instead I want to execute my command when I'm opening Adobe Acrobat! How to That do?
    Thanks so much.
    P.s.: excuse for my english

    Hi,
    AVAppDidInitialise is a notification so you need to register that you would like you code called when the application sends out that notification.
    Here is a sample
    ACCB1 ASBool ACCB2 PluginInit(void)
    //Register for an event notification
    AVAppRegisterNotification(AVAppDidInitializeNSEL,
    gExtensionID,ASCallbackCreateNotification(AVAppDidInitialize,
    &myNotificationCallback), NULL);
    //Create a user-defined function that is invoked when Adobe Reader or Acrobat
    //has finished initializing
    ACCB1 void ACCB2 myNotificationCallback(void *clientData)
    AVAlertNote("Acrobat has finished initializing");
    HTH
    Malcolm

Maybe you are looking for