LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-27-2007, 08:05 AM   #1
teddyZA
LQ Newbie
 
Registered: Apr 2007
Distribution: Xubuntu 7.04 , openSuSe 10.2 ,Mandriva 2006
Posts: 15

Rep: Reputation: 0
Howto change the shell Automatically each time i login???


which file would I edit(and what changes are to be made)to change my shell from bash to csh automatically everytime I login ,also give the line after the neccesary changes are made.

Last edited by teddyZA; 04-27-2007 at 08:06 AM.
 
Old 04-27-2007, 08:15 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
The file is "/etc/passwd" but you should NOT "edit" it. You should use the usermod command:

usermod -s /bin/csh <your login ID>

You have to have root to do that. Note that this changes your shell to csh so that is what you get a login rather than bash.

If you truly want to change from bash to csh AFTER login you can add:
"/bin/csh" to the end of your $HOME/.bashrc.
This would make csh a subshell of your bash (do "ps" after typing "/bin/csh" to see what I mean).

You could prevent it from being a subshell by putting:
"exec /bin/csh" at the end of your .bashrc. This makes it replace the shell rather than doing a fork to a subshell.

Note that csh uses different startup files than bash and ksh so make sure you add whatever you need to the appropriate files.

P.S. C shell - ugh!
 
Old 04-27-2007, 08:26 AM   #3
teddyZA
LQ Newbie
 
Registered: Apr 2007
Distribution: Xubuntu 7.04 , openSuSe 10.2 ,Mandriva 2006
Posts: 15

Original Poster
Rep: Reputation: 0
automatically everytime I login.. ,
this is in theory, i dont really want to do it. how would i do it via /etc/passwd ????.
just change /bin/bash to /bin/csh ?
its for a linux essentials correspndence course.
 
Old 04-27-2007, 08:33 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You can also use the chsh command. It will also edit /etc/passwd.
See the manpages for : shells chsh

I don't know what you mean by automatically. You change the shell, and it is changed until you change it back. If you log out and log in again, you start with the new shell.

Last edited by jschiwal; 04-27-2007 at 08:34 AM.
 
Old 04-27-2007, 09:10 AM   #5
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
The usermod command I mentioned modifies /etc/passwd.

My point was you should NOT modify the passwd file by hand if you can avoid it - it makes it easy to corrupt it and depending on how strong your authentication is might actually stop things from working on the assumption it is a hack attempt.

As noted by others you can use the chsh command to do the same thing.

It sounds however from your response that you want to do what I said about just running the /bin/csh (or exec /bin/csh) from command line.

You really shouldn't do your homework here - you learn more by figuring it out than by having people tell you what to do.
 
Old 04-27-2007, 09:39 AM   #6
teddyZA
LQ Newbie
 
Registered: Apr 2007
Distribution: Xubuntu 7.04 , openSuSe 10.2 ,Mandriva 2006
Posts: 15

Original Poster
Rep: Reputation: 0
ye I know, I dont however have much time to do this anymore due to unforseen circumstances.
otherwise I wouldve figured it out on my own. anyways thanks for the help.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Change Time automatically in linux juanb Linux - Software 5 09-24-2005 06:20 AM
Howto login as root with no password (automatically) vivekd Linux - Software 0 02-12-2004 04:29 AM
RH8 - how to automatically run a shell script at boot time nu-B Linux - Newbie 2 11-03-2003 02:47 PM
RH8 - how to automatically run iptables rules shell script at boot time nu-B Linux - General 1 10-29-2003 08:38 PM
time doesn't change automatically ashley75 Linux - General 2 10-27-2003 10:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration