# modify /etc/profile to have automatically bash when you add user



## freekette (Dec 6, 2011)

Hello everybody,

I'm a new user of FreeBSD (and I'm new in this forum), so I introduce myself: I'm freekette, and I would like discover Unix. So I'm trying FreeBSD for fun in a virtual machine (for the beginning)!

Now my question: I didn't like csh (I'm in the habit of using bash), so I've changed it using chsh. But now, I would like that, when I add user, the defaut shell be bash.

I tried (in /etc/profile)

```
SHELL=/usr/local/bin/bash
```
But that changes nothing: the default shell is always csh when I add a user.

What's wrong? Someone can help me?

Thank you.

(sorry for my english! :\)


----------



## fonz (Dec 6, 2011)

The file /etc/profile is for users who already have (ba)sh as their login shell. To change the adduser defaults, see adduser.conf(5).

Hope this helps,

Fonz


----------



## wblock@ (Dec 6, 2011)

See adduser.conf(5).  (And now I see that fonz beat me to it.)


----------



## Martillo1 (Dec 6, 2011)

And, for the sake of God (TM), do not ever change the root's shell.


----------



## freekette (Dec 6, 2011)

Thank you fonz and wblock@! I created adduser.conf, and I wrote 
	
	



```
defaultshell=usr/local/bin/bash
```
 and that works!

@Martillo1: just a question: why may I never change the root's shell? Why do you recommend me to NOT change this shell?

Finally, just a last question: imagine I want that for each new users something specific was done (eg: create a new directory, or a new file, or something else), is it possible to force the system to execute a script or to do an action when you add a user?

Thanks a lot.

(and still sorry for my english !)


----------



## phoenix (Dec 6, 2011)

Just search for the forum for "root shell bash" and you'll find many threads from people who've done this ... and cried themselves to sleep because of it.


----------



## SirDice (Dec 7, 2011)

freekette said:
			
		

> Thank you fonz and wblock@! I created adduser.conf, and I wrote
> 
> 
> 
> ...


Not sure if it's a typo but it should be */*usr/local/bin/bash.



> @Martillo1: just a question: why may I never change the root's shell? Why do you recommend me to NOT change this shell?


Bash is not part of the base. Search this forum and you will find lots of people having issues logging in after an update. To save yourself a lot of headaches, don't change root's shell.



> Finally, just a last question: imagine I want that for each new users something specific was done (eg: create a new directory, or a new file, or something else), is it possible to force the system to execute a script or to do an action when you add a user?


Have a look at the so-called 'skeleton' files in /usr/share/skel/.


----------



## Thorny (Dec 7, 2011)

phoenix said:
			
		

> Just search for the forum for "root shell bash" and you'll find many threads from people who've done this ... and cried themselves to sleep because of it.



Oh year, i remember.  That is an experience everybody must make. After that he will never do it again.


----------



## freekette (Dec 8, 2011)

Ok, I red threads about the shell change, and ... I 'll never do it! 
Thank you for all
bye


----------

