8

I'm an old-school Unix guy, so my Linux skills are probably slightly out-dated. But this seems like it should be simple enough.

On a Red Hat Linux system where I do not have root (it is administered by the company IT department), I want to be able to change my login shell. Running chsh gives me:

$ chsh -s /bin/bash
chsh: can only change local entries; use ypchsh instead.

So, I ran ypchsh instead:

$ ypchsh userid
ypchsh: can't find the master ypserver: Internal NIS error

What gives? Anyone have any other ideas?

2
  • 3
    Are you really using NIS? Or is it something like LDAP? May 12, 2011 at 15:32
  • I am pretty certain our network is using LDAP, as NIS is pretty antiquated at this point. May 12, 2011 at 16:19

5 Answers 5

8
  • NIS: ypchsh

  • LDAP:

    $ ldapmodify <<EOF
    dn: YOUR_DN
    changetype: modify
    replace: loginShell
    loginShell: /bin/bash
    -
    EOF
    

    (YOUR_DN might be in the form uid=$USER,ou=people,dc=example,dc=org; try ldapwhoami to see)

  • Hesiod: Ask system administrator.

  • Active Directory: Ask system administrator.

2
  • A coworker told me they thought it was LDAP, but ldapwhoami gives "ldap_sasl_interactive_bind_s: Unknown authentication method (-6) additional info: SASL(-4): no mechanism available:", so I'm guessing Active Directory at this point. I'll have to ask IT. May 13, 2011 at 12:59
  • @Ogre: Check /etc/nsswitch.conf (line 'passwd') to make sure. May 13, 2011 at 13:02
5

I have used one workaround to change my shell at login. I have just put bash which is used to change the shell in my .profile file.

You can find .profile in the user's home directory – use ls -la to see it.

Your .profile file may have something like this:

PATH=/usr/bin
export PATH
#Add this to go bash at login
bash
#end
2
  • 7
    This is a fair workaround. Although, it would be easier to have only /usr/bin/bash on a single line. Also it's probably nicer to 'exec' the new shell thus replacing the current process. Nov 16, 2012 at 7:05
  • I do the same with the .shellrc (changed to the correct file name), but I also declare an environment variable before, and exec bash only if it is not set, to allow manually executing the shell, and to prevent unfortunate loops. Note that you don't have to use a particular shell dialect, as you can just exec a script with the right shebang to perform these operations.
    – MayeulC
    Oct 23, 2018 at 15:10
4

So the real answer in my case is that the system admins (IT) want to lock down the standard config, so you have to ask them. But in the processt I discovered some more helpful commands for figuring out your LDAP configuration (if that happens to be how you are configured), just in case your system reports the same SASL error "ldap_sasl_interactive_bind_s: Unknown authentication method (-6) additional info: SASL(-4): no mechanism available:"

List the SASL authentication methods that your system supports:

 ldapsearch -x -LLL -s "base" -b "" supportedSASLMechanisms

Results might be something like:

dn:
supportedSASLMechanisms: EXTERNAL
supportedSASLMechanisms: DIGEST-MD5

You can then pass the authentication method to LDAP commands using the -Y option like so:

ldappasswd -Y DIGEST-MD5
ldapmodify -Y DIGEST-MD5
4

Another solution is to simply override your YP shell:

Add this line to your /etc/passwd:

+<USERNAME>::::::/bin/bash

Example:

+psalm33::::::/bin/bash

And add the following to your /etc/nsswitch.conf:

passwd: compat

passwd_compat: nis
1
  • As I stated, I do not have root on my system (so files in /etc are off-limits for editing). But, this answer might help someone else with a similar issue. Feb 20, 2014 at 14:29
0

Another way to see the credentials for the top answer is ldapsearch -x

ldapsearch -x uid=$(whoami)

You must log in to answer this question.

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