Skip navigation
This discussion is archived

.bashprofile problem

3439 Views 13 Replies Latest reply: Jul 21, 2010 2:51 PM by jarik RSS
tapas_mishra Calculating status...
Currently Being Moderated
Jul 12, 2010 12:26 AM
I added a command alias some=`ssh root@192.168.1.5`

in a file in home directory.I have forgotten the name of file.
If it was .bashrc or .bash_profile so now when ever I am opening a terminal I get a login prompt asking me password of root@192.168.1.5
what can I do to get rid of it.The file how do I locate my Finder window prefernces are to show all file extensions but this one is a hidden file.

I am uploading a snapshot please have lookmy problem right now is I am not able to get the shell see the snapshot here
http://www.flickr.com/photos/48996087@N07/4776570355/
Power PC G5, Mac OS X (10.5.8), 3 GB Ram
  • BobHarris Level 6 Level 6 (12,545 points)
    Currently Being Moderated
    Jul 12, 2010 6:31 AM (in response to tapas_mishra)
    Download TextWrangler (free download)
    <http://www.versiontracker.com/dyn/moreinfo/macosx/18529>

    Use TextWrangler -> File -> Open Hidden...
    Navagate to your home folder, and open the .bash_profile (or .bashrc, but I think it will be in .bash_profile).

    Either fix or remove the broken command.

    An alternative to TextWranger would be Smultron (free download)
    <http://www.versiontracker.com/dyn/moreinfo/macosx/24012>
    MacBook/10.5.8, iMac/i7/10.6.2, PowerMac/G5/10.4.11, Mac mini/10.5.6, iPod Touch, iBook/G4, MacBook Pro, iMac/G4
  • BobHarris Level 6 Level 6 (12,545 points)
    Currently Being Moderated
    Jul 12, 2010 8:10 AM (in response to tapas_mishra)
    I just wondering "How" TextWrangler did not work?

    Or was it I forgot to mention checking the [X] "Show hidden items" box in the file open dialog box? And change the "Enable" to "Everything"?

    Message was edited by: BobHarris
    MacBook/10.5.8, iMac/i7/10.6.2, PowerMac/G5/10.4.11, Mac mini/10.5.6, iPod Touch, iBook/G4, MacBook Pro, iMac/G4
  • BobHarris Level 6 Level 6 (12,545 points)
    Currently Being Moderated
    Jul 12, 2010 10:31 AM (in response to tapas_mishra)
    My bad. I had negleted to mention the

    Enable: Everything

    popup.

    I did some experimentation, and Smultron requires far fewer tricks to just open a hidden file. Smultron (free download)
    <http://www.versiontracker.com/dyn/moreinfo/macosx/24012>

    Smultron -> File -> Open Hidden...

    I am glad you managed to fix your .bash_profile via an ssh login from a different system.
    MacBook/10.5.8, iMac/i7/10.6.2, PowerMac/G5/10.4.11, Mac mini/10.5.6, iPod Touch, iBook/G4, MacBook Pro, iMac/G4
  • rccharles Level 5 Level 5 (5,155 points)
    Currently Being Moderated
    Jul 12, 2010 11:47 AM (in response to BobHarris)
    Macintosh-HD -> Applications -> Utilities -> Terminal

    # Show hidden files & folders in finder
    defaults write com.apple.finder AppleShowAllFiles TRUE   ;killall Finder
    # Normal display.  Hide hidden files & folders in finder
    defaults write com.apple.finder AppleShowAllFiles FALSE  ;killall Finder


    mac $ pwd
    /Users/mac
    mac $ ls -la .b*
    -rw-------   1 mac  staff  15798 Jul 11 23:32 .bash_history
    -rwx-w--w-   1 mac  staff    265 Dec 27  2009 .bash_profile*
    -rw-r--r--   1 mac  staff    100 May 25  2006 .bashrc
    mac $ pico .bash_profile 
    mac $ 


    Robert
    iMac G3 600, Mac OS X (10.4.11)
  • rccharles Level 5 Level 5 (5,155 points)
    Currently Being Moderated
    Jul 13, 2010 11:40 AM (in response to tapas_mishra)
    Here is Applescript to show hidden files in the finder. Applescript used the sh shell & your unix profiles are not run.

    I'd sudo'd from another account.

    (*
     Name: toggle-hidden
     
     
       Author: rccharles
       
       
       Copyright 2010 rccharles
       GNU General Public License 
       
        This program is free software: you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation,  version 3
       
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
     
        For a copy of the GNU General Public License see <http://www.gnu.org/licenses/>.
     
       *)
     
    on run
       -- Write a message into the event log.
       log "  --- Starting on " & ((current date) as string) & " --- "
       
       try
          set results to do shell script "defaults read com.apple.finder AppleShowAllFiles"
          log "results = " & results
       on error errorMsg
          -- Most likely, the variable AppleShowAllFiles does not exit.  
          -- AppleShowAllFiles isn't defined in a newly created account. 
          -- The write command below will create the AppleShowAllFiles variable.
          log "Error ..." & errorMsg
          set results to "FALSE"
       end try
       
       if results = "FALSE" then
          display dialog "Displaying all files.  Finder will restart." giving up after 2
          set the_rc to do shell script "defaults write com.apple.finder AppleShowAllFiles TRUE  ;killall Finder"
          
       else
          display dialog "Hiding hidden files.  Finder will restart.." giving up after 2
          
          set the_rc to do shell script "defaults write com.apple.finder AppleShowAllFiles FALSE  ;killall Finder"
          
       end if
       
    end run
    iMac G3 600, Mac OS X (10.4.11)
  • reezer Calculating status...
    Currently Being Moderated
    Jul 19, 2010 3:14 AM (in response to tapas_mishra)
    use vim to edit the file via:

    vi ~/.bash_profile

    to open your file. Hit the "a" key to begin editing and hit ":wq" to save your changes and quit vim. Afterward, use

    source .bash_profile

    to apply the changes you made to the .bash_profile file. Personally, I use similar alias commands in my .bash_profile file, and I am not prompted for a password unless I try to use the command name given on the left hand side of the equal sign.

    In an unrelated note, I would urge you not to logon to a system as root via ssh unless you absolutely have to. I recommend that you logon as a normal user and use "su" or "su -" to get root privileges. In fact, I recommend turning off the ability to logon as root in whatever system you are trying to use as this feature was the recent target of a massive "dumb" attack to gain access to many Linux systems.
    MacBook Pro 15" Corei5, Mac OS X (10.6.4)
  • BobHarris Level 6 Level 6 (12,545 points)
    Currently Being Moderated
    Jul 19, 2010 6:59 AM (in response to reezer)
    use vim to edit the file via:

    vi ~/.bash_profile

    If you read the entire thread, you will see that getting a shell prompt was the problem, as the .bash_profile immediately does an ssh to a remote system.
    MacBook/10.5.8, iMac/i7/10.6.2, PowerMac/G5/10.4.11, Mac mini/10.5.6, iPod Touch, iBook/G4, MacBook Pro, iMac/G4
  • reezer Level 1 Level 1 (15 points)
    Currently Being Moderated
    Jul 20, 2010 9:02 PM (in response to tapas_mishra)
    Apologies for not reading in depth Gents. If the problem has not been resolved...

    I've seen a similar issue before on a Unix system that was caused by a corrupted ".software" user file that was implemented for loading modules.

    The admin solved the issue by logging on to their account (root or other user) and using root privileges to access the user's home directory. Afterword, they were able to fix or restore the .software file for the user and reapplied default permissions.

    I hope this helps.

    Good luck.
    MacBook Pro 15" Corei5, Mac OS X (10.6.4)
  • jarik Level 4 Level 4 (1,005 points)
    Currently Being Moderated
    Jul 21, 2010 2:51 PM (in response to tapas_mishra)
    The problem in your alias command is the backquotes - write it with single quotes or double-quotes instead.

    As for getting around the problem of not getting to a command prompt beyond the ssh password prompt: what happens if you just hit enter, doesnt't it give you a shell after three times?

    You could also create a new admin user, open a Terminal as that user and then

    sudo mv ~firstuser/.bashrc ~firstuser/dot-bashrc

    (and the same for .bash_profile and .profile) if you're not comfortable editing the file directly.

    Or get a shell as first user from the second user's Terminal with

    sudo su seconduser -c "bash --norc --noprofile"


    Jari
    Macbook, MacBook Pro, Powerbook G4 (10.5.x), Intel Mini

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.