Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
3  
Are you really using NIS? Or is it something like LDAP? –  Ignacio Vazquez-Abrams May 12 '11 at 15:32
    
I am pretty certain our network is using LDAP, as NIS is pretty antiquated at this point. –  Ogre Psalm33 May 12 '11 at 16:19
add comment

4 Answers 4

up vote 6 down vote accepted
  • 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.

share|improve this answer
    
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. –  Ogre Psalm33 May 13 '11 at 12:59
    
@Ogre: Check /etc/nsswitch.conf (line 'passwd') to make sure. –  grawity May 13 '11 at 13:02
add comment

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
share|improve this answer
add comment

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
share|improve this answer
4  
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. –  Peter Jenkins Nov 16 '12 at 7:05
add comment

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
share|improve this answer
    
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. –  Ogre Psalm33 Feb 20 at 14:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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