10 Replies Latest reply: May 9, 2012 1:54 PM by Sami Cooyar
Sami Cooyar Level 1 Level 1 (85 points)

Hello,

 

I am trying to do research on how to fix my current problem of not being able to open my terminal window.  When attempting to do so I get the following error message:

 

You are unauthorized to run this application.

The administrator has set your shell to an illegal value.

 

I looked at some previous posts and some people said download iterm2 and put the following command: sudo chsh -s /bin/bash my_username.  After this enter password and it should be fixed.  However when doing that I get the following response: SC is not in the sudoers file.  This incident will be reported.

 

Couple of things, firstly SC (which is me) is the administrator to this computer (this is my computer and there are no other users on it). 

 

Either way can anyone give some suggestions on how to solve this problem so that I am able to open the terminal window.

 

Much thanks in advance for anyones assistance.

 

Sami


MacBook (13-inch Early 2008), Mac OS X (10.7.3), 2.4 GHz Intel Core 2 Duo
  • 1. Re: Unable to Open Terminal Window
    Linc Davis Level 10 Level 10 (117,920 points)

    Create a new administrator account in which to change your shell and also fix the sudoers file, which is apparently corrupt. It should have the following content:

     

    # sudoers file.
    #
    # This file MUST be edited with the 'visudo' command as root.
    # Failure to use 'visudo' may result in syntax or file permission errors
    # that prevent sudo from running.
    #
    # See the sudoers man page for the details on how to write a sudoers file.
    #
    
    
    # Host alias specification
    
    
    # User alias specification
    
    
    # Cmnd alias specification
    
    
    # Defaults specification
    Defaults          env_reset
    Defaults          env_keep += "BLOCKSIZE"
    Defaults          env_keep += "COLORFGBG COLORTERM"
    Defaults          env_keep += "__CF_USER_TEXT_ENCODING"
    Defaults          env_keep += "CHARSET LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE"
    Defaults          env_keep += "LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME"
    Defaults          env_keep += "LINES COLUMNS"
    Defaults          env_keep += "LSCOLORS"
    Defaults          env_keep += "SSH_AUTH_SOCK"
    Defaults          env_keep += "TZ"
    Defaults          env_keep += "DISPLAY XAUTHORIZATION XAUTHORITY"
    Defaults          env_keep += "EDITOR VISUAL"
    Defaults          env_keep += "HOME MAIL"
    
    
    # Runas alias specification
    
    
    # User privilege specification
    root          ALL=(ALL) ALL
    %admin          ALL=(ALL) ALL
    
    
    # Uncomment to allow people in group wheel to run all commands
    # %wheel          ALL=(ALL) ALL
    
    
    # Same thing without a password
    # %wheel          ALL=(ALL) NOPASSWD: ALL
    
    
    # Samples
    # %users  ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
    # %users  localhost=/sbin/shutdown -h now
    
  • 2. Re: Unable to Open Terminal Window
    Sami Cooyar Level 1 Level 1 (85 points)

    Thank you for your feed back Linc.

  • 3. Re: Unable to Open Terminal Window
    BobHarris Level 6 Level 6 (13,110 points)

    You are unauthorized to run this application.

    The administrator has set your shell to an illegal value.

    I have 2 thoughts.

     

    1st is that your account infomation is actually corrupt.  I would look at System Preferences -> Users & Groups -> unlock the padlock in the lower left corner (click on it) -> Option Click on your account name -> Advanced Options.  Now check that you have valid account information.  The typical information for the first account created on a system would be: User ID 501, Group Staff, Account name is your short name (SC ??),  Login Shell: /bin/bash (this is one item to check carefully), Home Directory /Users/SC (or your short name),  UUID a very long number.  If it does not look something like this, especially /bin/bash, then I would be concerned.

     

    The other possibility is that your /etc/shells file has become corrupt, or missing in action.  You /etc/shells file should look like:

     

    # List of acceptable shells for chpass(1).
    # Ftpd will not allow users to connect who are not using
    # one of these shells.
    
    
    /bin/bash
    /bin/csh
    /bin/ksh
    /bin/sh
    /bin/tcshe
    /bin/zsh
    

     

    If /etc/shells is missling look for anything closely named, such as /etc/shells~orig, which I have seen reported before resulting in an missing /etc/shells.

  • 4. Re: Unable to Open Terminal Window
    Sami Cooyar Level 1 Level 1 (85 points)

    Hi Bob,

     

    Thanks for the response.  I looked at what you are saying for Option 1 and it is exactly as you describe.  In regards to Option 2 (the other possibility) i.e my /etc/shells being corrup.  How do I check this to see if it is correct as you are saying?  Where would I go to see this?

     

    Thanks again for your time in helping me.

  • 5. Re: Unable to Open Terminal Window
    BobHarris Level 6 Level 6 (13,110 points)

    My post showed you exactly what /etc/shells should look like on just about every Mac OS X system.   If yours does not look like that, then it could be the problem.  If it look exactly like that, then you have some other problem.

     

    Oh, yea.  How to you view it when you do not have a Terminal session :-)

     

    Finder -> Go -> Go to folder -> /etc

     

    Control-Click on 'shells' -> Open With -> TextEdit

     

    Message was edited by: BobHarris

  • 6. Re: Unable to Open Terminal Window
    Sami Cooyar Level 1 Level 1 (85 points)

    Sorry I'm not the most tech advance person.  I understand what it should look like but where do I go to see this is what I'm trying to figure out?  I don't know where I go to see the /etc/shells.

  • 7. Re: Unable to Open Terminal Window
    Sami Cooyar Level 1 Level 1 (85 points)

    Sorry just saw the rest of your message.  Disregard my reply just now.  Will go and check it out.

     

    Thanks!

  • 8. Re: Unable to Open Terminal Window
    Sami Cooyar Level 1 Level 1 (85 points)

    Ok just did it and here's what we have.  Firstly I have two files named shells.  One called "shells" and another called "shells~orig".  When opening shells it opens a blank text edit page that is blank.  When I opened the shells~orig, it contains exactly what you have above.  Should I have both these files?Screen Shot 2012-05-09 at 1.40.45 PM.png

    I've attached a screen shot of the file names.  It seems strange to me that the shells date created is Dec 31, 1969.

     

    Any thoughts/suggestions.

  • 9. Re: Unable to Open Terminal Window
    BobHarris Level 6 Level 6 (13,110 points)

    An empty /etc/shells is most likely the root of your probem.

     

    I would try using the Finder to rename the shells~orig to shells

     

    I'm assuming the Finder will prompt you for your Admin password.

     

    If that does not work, can your restore the file from a backup (Time Machine) perhaps?

     

    I think you can use something like TextWranger (free download from Bare-Bones software), and I think TextWranger will let you edit a system file after it prompts you for your admin password.

     

    Hopefully that will get you going.  If you run into problems, we can try to figure out something else.

  • 10. Re: Unable to Open Terminal Window
    Sami Cooyar Level 1 Level 1 (85 points)

    Great thanks Bob! Just went and deleted the shells file then changed shell~orig to shells and now my terminal is able to open.

     

    Again I appreciate your time and efforts in helping me.

     

    Thank you!