WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: change shell  (Read 7039 times)

ali

  • Guest
change shell
« on: September 01, 2011, 11:19:28 PM »
i'm interested in changing my shell from sh to bash, i notice the chsh command is not available here so what can i do to change it?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11581
Re: change shell
« Reply #1 on: September 01, 2011, 11:25:40 PM »
Hi ali
Have you tried installing  bash.tcz ?

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: change shell
« Reply #2 on: September 02, 2011, 01:30:49 AM »
Apart from the obvious requirement to have the alternative shell installed I believe you will need to ensure that 'bash' is an "acceptable" login shell, e.g. via:
    which bash | sudo tee -a /etc/shells > /dev/null
and that the respective field has been update in the user accounts, e.g. via
    sudo sed -i '/^ali:/s#:[^:]\+$#:/usr/local/bin/bash#' /etc/passwd
(which assumes that the change should be applied only for user 'ali').


EDIT: Corrections to the second command (it needed '-i' and also has to be run by a super-user).
« Last Edit: September 03, 2011, 03:26:45 AM by maro »

ali

  • Guest
Re: change shell
« Reply #3 on: September 03, 2011, 01:36:26 AM »
ali@mini:~$ cat /etc/passwd | grep ali
ali:x:1000:50:Linux User,,,:/home/ali:/bin/sh

ali@mini:~$ which bash | sudo tee -a /etc/shells > /dev/null

ali@mini:~$ cat /etc/passwd | grep ali
ali:x:1000:50:Linux User,,,:/home/ali:/bin/sh

ali@mini:~$ sed '/^ali:/s#:[^:]\+$#:/usr/local/bin/bash#' /etc/passwd
root:x:0:0:root:/root:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/false
tc:x:1001:50:Linux User,,,:/home/tc:/bin/sh
ali:x:1000:50:Linux User,,,:/home/ali:/usr/local/bin/bash

ali@mini:~$ cat /etc/passwd | grep ali
ali:x:1000:50:Linux User,,,:/home/ali:/bin/sh

ali@mini:~$ cat /etc/shells
# /etc/shells: valid login shells.
/bin/sh
/bin/ash
/usr/local/bin/bash
« Last Edit: September 03, 2011, 01:38:59 AM by ali »

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: change shell
« Reply #4 on: September 03, 2011, 03:30:21 AM »
There were two minor mistakes in the 'sed' command: It needed the '-i' option to work in-place , and it needs to be run by 'root'. I've therefore updated reply #2.