?
Solved

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

Posted on 2003-11-11
9
Medium Priority
?
712 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 150 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
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host 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

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

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

This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month13 days, 2 hours left to enroll

777 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