Solved

Wrong '.bashrc', wont let me login..

Posted on 2003-11-11
9
709 Views
Last Modified: 2008-03-17
Hi all...
I was trying to call a 'script' file when the system boots up. So I added the script path to /etc/rc.d/rc.local file. This didnt seem to work. So i added it to /root/.bashrc and i think this screwed up my system.
It wont let me login to 'root' account.
The system bootsup and after i try to login it just gives me a blue screen.
I'm thinking i did something wrong in the script file. It has nothing much but a single line....
"java filename"
Think i didnt set the PATH / CLASSPATH rite.. so may be the system is looking for it or something.

Is there anyway i can access the '.bashrc' file to modify it??

Thanks.
0
Comment
Question by:queryanalyzer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 5

Accepted Solution

by:
g0rath earned 50 total points
ID: 9728237
if you created another non-root account, log in as that account
 su root

enter the root password and it doesn't execute the bashrc files...

if you do

su - root

then is does a proper login that runs the .bashrc file.
0
 
LVL 38

Expert Comment

by:yuzh
ID: 9728281
use a linux bootable FD or CD, boot up the system to single user mode,
manually mount the partition that contains the /root/.bashrc , then edit
the file or just remove it.

You can get a mini-linux distributions from http://www.toms.net/rb/, http://www.kernel.org/pub/dist/superrescue/v2/ and boot up the mini-linux.
and then mount the partition if you don't have the FD or CD on hand.
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 9728978
either use yuzh suggestion or still easier, if it runs ftp service, ftp a new bashrc file !!!!
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 20

Expert Comment

by:Gns
ID: 9730359
Or if it doesn't run ftp, but ssh... use scp or sftp;).

With a variation, you can transform g0raths example into something working:
log on as a regular user, then
su -s <absolute path to another shell... /bin/tcsh or whatever...>
<passwd>
and you'd be running another shell entirely, thus not triggering the flawed .bashrc
Why is g0raths example bad?
Because .bashrc will be read both if you do "su root" and "su - root" (definitely for the former, very very probable for the latter)... ~/.bash_profile,  ~/.bash_login,  and  ~/.profile is another matter though.
man bash
explains the order files are read, depending on interactivity and login status.

You need use the -s flag to su, to set the shell that it'll execute, and not the -c flag, since that would invoke bash to invoke the other shell.
Do
cat /etc/shells
to see what shells you have available, and do
su --help
to see that your su is capable of using the -s (or --shell=...) option.

-- Glenn
0
 
LVL 5

Expert Comment

by:g0rath
ID: 9731310
ah yes....doh! forgot about that...

So this won't work either?
su -c '/bin/bash --norc --noprofile'

I was thinking only of the ~/.bash_login and forgot the he said ~/.bashrc


/etc/shells shows the shells that you are allowed to run via the -s option.
0
 
LVL 20

Expert Comment

by:Gns
ID: 9731797
> So this won't work either?
> su -c '/bin/bash --norc --noprofile'
Exactly... It translates to
/bin/bash -c '/bin/bash --norc --noprofile'
where the first bash would read .bashrc, but not the second.
Wellplaced echos would demonstrate the effect nicely:-).

> I was thinking only of the ~/.bash_login and forgot the he said ~/.bashrc
Thought you mighthave;)

-- Glenn
0
 
LVL 1

Expert Comment

by:arn0ld
ID: 9735222
the " blue screen"  caught my attention - reminds me of an X problem. How about CTRL-ALT-F1 & see if you can liogin from the prompt?
0
 
LVL 20

Expert Comment

by:Gns
ID: 9737892
If he hangs in .bashrc.... You might get this for the most innocent of things... Like starting X:-).
If s/he still hangs after removing the java thing from .bashrc, then one might look a t the X problem as something separate... at least how I see it:)

-- Glenn
0
 

Author Comment

by:queryanalyzer
ID: 9745500
Thanks a lot guys...
   I tried to login from another user account and 'su root' and.......  it worked.
I know u guys said it wudnt... but it did. I dont know of anything else went wrong too.

But thanks a lot...  and sorry i took sometime to respond.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to show how we can create Linux Mint virtual machine using Oracle Virtual Box. To install Linux Mint we have to download the ISO file from its website i.e. http://www.linuxmint.com. Once you open the link you will see …
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question