1

I'm trying to change the useradd default shell, so when the next new user created its shell would be /usr/sbin/tcsh.

One way doing that is by running the following command :

useradd -D -s /usr/sbin/tcsh

Another way is by editing the /etc/default/useradd:

SHELL=/usr/sbin/tcsh

I was wondering what is the difference between the two options?

Thanks in advance

0

There is no effective difference. There are many ways of setting configuration. They both edit the SHELL variable in the /etc/default/useradd file.

Check the man page with:

$ man useradd

Then look for the -s argument.

One might be more convenient or easier to remember than the other for some users. Since you have already tested both, you can decide for yourself which is easier for you to remember or use.

| improve this answer | |
0

In the man page for useradd the normal behaviour of the -s option is:

-s, --shell SHELL The name of the user's login shell. The default is to leave this field blank, which causes the system to select the default login shell specified by the SHELL variable in /etc/default/useradd, or an empty string by default.

The -s option when invoked with -D behaves as follows:

-s, --shell SHELL

The name of a new user's login shell.

This option sets the SHELL variable in /etc/default/useradd.

So both methods set the SHELL variable in the /etc/default/useradd file.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.