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

nickn

Well-Known Member
PartnerNOC
Jun 15, 2003
616
1
168
Edit /etc/shells remove /bin/sh from the top and place /bin/bash on top.
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
33
473
Go on, have a guess
EasyNetwork said:
All default accounts with shell (non jailed) are made using /bin/sh how do I tell CPanel to use /bin/bash instead?

Thank you.
That's odd. One my RHE and CentOS servers, non-jailed shell accounts use bash by default, not sh.
 

nickn

Well-Known Member
PartnerNOC
Jun 15, 2003
616
1
168
EasyNetwork said:
Um that doesn't change anything. Thanks for trying.
Remove /bin/sh then. It works fine for me. I removed and didn't change position though.
 

nickn

Well-Known Member
PartnerNOC
Jun 15, 2003
616
1
168
EasyNetwork said:
... :rolleyes: why would removing /bin/sh from /etc/shells fix this? :rolleyes: :rolleyes:
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. :)
 

nickn

Well-Known Member
PartnerNOC
Jun 15, 2003
616
1
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:
 

nickn

Well-Known Member
PartnerNOC
Jun 15, 2003
616
1
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.
 
Last edited:

EasyNetwork

Well-Known Member
May 14, 2003
46
0
156
New York
cPanel Access Level
Root Administrator
nickn said:
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.

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