Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Default shell pref. Change /bin/sh to /bin/bash?

Discussion in 'General Discussion' started by EasyNetwork, Oct 16, 2004.

  1. EasyNetwork

    EasyNetwork Well-Known Member

    Joined:
    May 14, 2003
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    New York
    cPanel Access Level:
    Root Administrator
    All default accounts with shell (non jailed) are made using /bin/sh how do I tell CPanel to use /bin/bash instead?

    Thank you.
     
  2. EasyNetwork

    EasyNetwork Well-Known Member

    Joined:
    May 14, 2003
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    New York
    cPanel Access Level:
    Root Administrator
    Bump.

    Bump. Bump. Bump.
     
  3. EasyNetwork

    EasyNetwork Well-Known Member

    Joined:
    May 14, 2003
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    New York
    cPanel Access Level:
    Root Administrator
  4. nickn

    nickn Well-Known Member
    PartnerNOC

    Joined:
    Jun 15, 2003
    Messages:
    619
    Likes Received:
    1
    Trophy Points:
    168
    Edit /etc/shells remove /bin/sh from the top and place /bin/bash on top.
     
  5. EasyNetwork

    EasyNetwork Well-Known Member

    Joined:
    May 14, 2003
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    New York
    cPanel Access Level:
    Root Administrator

    Um that doesn't change anything. Thanks for trying.
     
  6. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,460
    Likes Received:
    21
    Trophy Points:
    463
    Location:
    Go on, have a guess
    That's odd. One my RHE and CentOS servers, non-jailed shell accounts use bash by default, not sh.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. djmerlyn

    djmerlyn Well-Known Member

    Joined:
    Aug 31, 2004
    Messages:
    201
    Likes Received:
    1
    Trophy Points:
    168
    Same here~
     
  8. EasyNetwork

    EasyNetwork Well-Known Member

    Joined:
    May 14, 2003
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    New York
    cPanel Access Level:
    Root Administrator
    We do not use Linux. :cool:

    Any ideas?
     
  9. dave9000

    dave9000 Well-Known Member

    Joined:
    Apr 7, 2003
    Messages:
    891
    Likes Received:
    1
    Trophy Points:
    168
    Location:
    arkansas
    cPanel Access Level:
    Root Administrator
    might help if ya told us what you did use
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. nickn

    nickn Well-Known Member
    PartnerNOC

    Joined:
    Jun 15, 2003
    Messages:
    619
    Likes Received:
    1
    Trophy Points:
    168
    Remove /bin/sh then. It works fine for me. I removed and didn't change position though.
     
  11. EasyNetwork

    EasyNetwork Well-Known Member

    Joined:
    May 14, 2003
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    New York
    cPanel Access Level:
    Root Administrator
    ... :rolleyes: why would removing /bin/sh from /etc/shells fix this? :rolleyes: :rolleyes:
     
  12. EasyNetwork

    EasyNetwork Well-Known Member

    Joined:
    May 14, 2003
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    New York
    cPanel Access Level:
    Root Administrator

    FreeBSD 5.2 :)
     
  13. nickn

    nickn Well-Known Member
    PartnerNOC

    Joined:
    Jun 15, 2003
    Messages:
    619
    Likes Received:
    1
    Trophy Points:
    168
    Keep rolling your eyes buddy. If you're using Linux, it does fix it. Thanks though. As I have no interest in assisting further, good luck in your search on how to do this with FreeBSD. :)
     
  14. nickn

    nickn Well-Known Member
    PartnerNOC

    Joined:
    Jun 15, 2003
    Messages:
    619
    Likes Received:
    1
    Trophy Points:
    168
    You know what...

    Actually, I will help. Open /etc/adduser.conf

    search for "defaultshell"

    Change defaultshell = "sh" to "bash"

    Badda bing. :rolleyes: :rolleyes: :rolleyes:
     
  15. EasyNetwork

    EasyNetwork Well-Known Member

    Joined:
    May 14, 2003
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    New York
    cPanel Access Level:
    Root Administrator
    I'm not using Linux.
     
  16. EasyNetwork

    EasyNetwork Well-Known Member

    Joined:
    May 14, 2003
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    New York
    cPanel Access Level:
    Root Administrator
    :rolleyes: It was already set to bash and it has nothing to do with CPanel. :rolleyes: :rolleyes:
     
  17. nickn

    nickn Well-Known Member
    PartnerNOC

    Joined:
    Jun 15, 2003
    Messages:
    619
    Likes Received:
    1
    Trophy Points:
    168
    Code:
    if ($hasshell eq "n") {
            print "Removing Shell Access ($hasshell)\n";
       system("/usr/bin/chsh","-s","/usr/local/cpanel/bin/noshell",$user);
    } else {
            print "Keeping Shell Access ($hasshell)\n";
            if ($system !~ /freebsd/i || -e "/var/cpanel/jailshell2") {
                    if ($CPCONF{"jaildefaultshell"} eq "1") {
                            print "Jail Shell Enabled\n";
                            system("chsh","-s","/usr/local/cpanel/bin/jailshell","$user");
                    }
            }
    
    
    }
    
    Code:
    if ($system =~ /freebsd/i) {
            ($fd0, $fd1) = POSIX::pipe();
            POSIX::write( $fd0, $pass, length($pass) );
            if (int($minuid) > 1) {
                    system("/usr/sbin/pw","adduser","$user","-i","$minuid,32000","-b","$mnt","-h",$fd1);
            } else {
                    system("/usr/sbin/pw","adduser","$user","-b","$mnt","-h",$fd1);
            }
    } else {
            if (-e "/etc/SuSE-release" && -x "/usr/sbin/useradd") {
                    system("/usr/sbin/groupadd","${user}");
                    system("/usr/sbin/useradd","-d","${mnt}/${user}","-g","${user}","${user}");
            } else {
                    $result = system("/scripts/adduser","$user","$mnt","!!");
            }
            open(CHPASS,"|/scripts/chpass");
            print CHPASS "${user} ${pass}\n";
            close(CHPASS);
    }
    
    Notice, if user selects to have shell, and it's not jailshell...than cPanel does not specify a particular shell to use, hence it will use the sytem default.
     
    #17 nickn, Oct 24, 2004
    Last edited: Oct 24, 2004
  18. EasyNetwork

    EasyNetwork Well-Known Member

    Joined:
    May 14, 2003
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    New York
    cPanel Access Level:
    Root Administrator

    Blah, I did not know it was using pw to add users.

    /etc/shells or /etc/adduser.conf have nothing to do with pw.

    Anyways here is fix for pw+freebsd =

    Code:
    echo defaultshell = \"bash\" > /etc/pw.conf
    Thanks Nick for pasting that code :p
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice