Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2003-11-11
9
Medium Priority
?
715 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

636 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