-1

For a Solaris 11 Server Config Review that I am doing, I have following lines in my /etc/passwd file:

root:x:0:0:Super-User:/root:/usr/bin/bash
daemon:x:1:1::/:
bin:x:2:2::/usr/bin:
sys:x:3:3::/:
adm:x:4:4:Admin:/var/adm:
lp:x:71:8:Line Printer Admin:/:
uucp:x:5:5:uucp Admin:/usr/lib/uucp:
nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico
.....

Last word of each line means the shell where they log in to. If nothing is mentioned, is it /usr/bin/bash by default? From above, can I affirm if the accounts daemon, bin, sys, adm, lp, uucp can log in or not?

Please note that I have received this as an output to one of the scripts that my team had run, and hence, I may not be able to look for any info that you ask which is outside the script. But your help is really appreciated.

Thanks

3 Answers 3

4

I believe the answers you've got so far are slightly inaccurate or at least incomplete.

You specifically mention that the question is related to Solaris 11 and this is important to the answer.

If no shell is explicitly mentioned in /etc/passwd then it is correct as the man page says that /usr/bin/sh will be used but this is a logical link to Korn 93 Shell. In other words: For those accounts where no shell is mentioned in /etc/passwd the shell is Korn 93, not Bourne Shell as you might think. Solaris used to have an affinity for the Korn shell (long time ago) so this is the reason why /usr/bin/sh points to the Korn Shell.

Here's an Oracle link with more info: New shell in Oracle Solaris 11.

Extra info: So does this mean that Korn shell is the "default shell" on Solaris 11 ? No! When you create an account on Solaris 11 using the useradd command and you do not explicitly specify a shell then Bash shell (/usr/bin/bash) will be used. Hence I would say that Bash is the default shell on Solaris.

Hope this helps.

4
  • Amongst other things, the question isn't really about the 'default' shell it's about the shell you get when one isn't specified. The real test here is whether /usr/bin/sh will run a script that contain ksh syntax that is invalid in sh. If it will then it's ksh if it won't then for all practical purpose it's sh
    – user9517
    Feb 16, 2014 at 16:27
  • Edited my answer: added a link which you may find useful and made it more clear what part is the answer to your question and what part is just "bonus info" (which you can disregard) Feb 16, 2014 at 22:09
  • @Iain. Sorry. Mistook you for the OP. Feb 16, 2014 at 22:19
  • Thanks @unixhacker2010. That's a nicer explanation and gives me what I want. Feb 17, 2014 at 15:19
2
# man -s 4 passwd    
[...]
     login-shell    is the user's initial shell program. If  this
                    field   is   empty,   the  default  shell  is
                    /usr/bin/sh.
[...]

# man -s 4 shadow
[...]
     password    An encrypted password for the user generated  by
                 crypt(3C),  a  lock  string to indicate that the
                 login is not accessible,  or  no  string,  which
                 shows that there is no password for the login.

                 The lock string is defined as *LK* in the  first
                 four characters of the password field.
[...]
1
2

No, from the above you can't tell if the accounts listed are able to log in or not. To do that you will have to inspect the entry for each account in the /etc/shadow file. In particular you should look at the password field and potentially the expire field.

Regarding the default shell, this would be easy for you to test. Just create a user account and check you can log in. Edit the /etc/passwd file to remove the shell for the test account, then log in again and see what shell it is.


So I spun up a Solaris 11 Vm and it turns out to be sh.

4
  • Thanks for the first part of the answer. As for the second part - isn't there any default value that's decided for a no mention in the shell? I don't have access to the servers, all I have is an XML output containing the above info. What other things can I do? Feb 13, 2014 at 13:23
  • @NiravZaveri: You should read the documentation or get someone who does have access to the server to carry out the test for you or spin up a Solaris 11 VM and run the test on it - it's really not that hard to help yourself here.
    – user9517
    Feb 13, 2014 at 13:23
  • Thanks @lain. That helped. Unfortunately, I won't be able to upvote any answers, as I don't have "15"/"enough" rep to do upvoting! Feb 17, 2014 at 15:18
  • Came here to upvote your answer, now that I have enough rep. :) Jun 3, 2015 at 7:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .