[ale] how to get bash to run .bash_profile?

Sims, Ted ted at tedsims.com
Mon Feb 3 04:00:41 EST 2003


I'm pretty sure that .bash_profile is only read on a login shell. 

OK. I'm not sure what you are trying to do, but maybe the following will help. If you do this on Slackware, after booting it will automatically log in a user named "user" and start X. I actually use a user named "user".

Make the user a directory named /home/user

Add a line like this one to /etc/passwd

 user::1004:100::/home/user:/bin/bash

"user" doesn't have a passwd and login won't prompt for one, like that.

If you use shadow passwords, execute pwunconv before editing, and pwconv after.

Make little program to login "user". I got this from http://www.linuxgazette.com/issue72/chung.html 
 
 int main() {
    execlp( "login", "login", "-f", "user", 0);
 }

Compile it, rename to "autologinuser" and put it under /sbin
Make sure it is set executable
 install -m 744 autologinuser /sbin

In inittab, put the following line in place of all the standard console login getties
 c1:1235:respawn:/sbin/agetty -n -l /sbin/autologinuser 38400 tty1 linux

Under /home/user, make a .bash_profile, containing
 startx

Now, when you boot, it will automagically login "user", and start and X session. Exiting the session or ctrl-alt-backspace will give you a console. Ctrl-D in the console, will put you back into X.




On 03 Feb 2003 00:02:47 -0500
da Black Baron <dbaron13 at atl.bellsouth.net> wrote:

> You want to write a .bashrc file and a .profile file.  Bash will ingore
> something named .bash_profile... :-)
> 
> On Fri, 2003-01-31 at 20:55, Christopher Bergeron wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >  
> > Hey guys, how do I get bash to run .bash_profile?  I'm looking at my 
> > startup, and I'm trying to figure out why when I set my inittab to 
> > load:  /bin/bash instead of a "getty".  When it spawn's by bash session, 
> > it doesn't load my .bash_profile.  Is there a way I can load a bash 
> > shell and have it subsequently execute my .bash_profile?
> > 
> > Alternatively, is there a way to get a getty to log in automatically (on 
> > slackware!).  For some reason, I can't get slackware to use the 
> > mingetty+autologin patch/binary.  I was able to get it to work on RhAT, 
> > but not on Slack8.
> > 
> > Preferably, I'd like to skip "getty" altogether...
> > 
> > 
> > Thanks!
> > - -CB
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.2.1 (MingW32)
> > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> >  
> > iD8DBQE+OykYTKCy0t3zQgURAkdcAJ91SBx84EVqeavZ1/HOOQhy2SUcWgCgxUfv
> > wZS2HDYI0mkgVl2Ozs6YUo0=
> > =dFaj
> > -----END PGP SIGNATURE-----
> > 
> > 
> > _______________________________________________
> > Ale mailing list
> > Ale at ale.org
> > http://www.ale.org/mailman/listinfo/ale
> -- 
> -------------------------------------------------------------------------
> -------------------------------------------------------------------------
> "Here's my family tree.  As far as I can tell, my relatives were 
> carnival folk who were touring this place called Hiroshima in 
> the summer of 1945.  Because they lost most of their hair, they 
> mostly married each other.  And here I am"
> 
> -------------------------------------------------------------------------
> -------------------------------------------------------------------------      
>                                                         (,,oBo,,)       
>  Wylde Bill                                               ||||          
> __________________________________________           http://lyst.org    
>                 
> http://mrpooter.sytes.net                              
> wyldechylde at geocities.com
> -------------------------------------------------------------------------
> -------------------------------------------------------------------------  
> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale






More information about the Ale mailing list