(X)ubuntu 8.04 LTS /etc/shells orphans question

Asked by A. Denton

This is an output of my "/etc/shells" file.

# /etc/shells: valid login shells
/bin/csh
/usr/bin/es
/usr/bin/ksh
/bin/ksh
/usr/bin/rc
/usr/bin/tcsh
/bin/tcsh
/usr/bin/esh
/usr/bin/screen
/bin/sh
/bin/dash
/bin/bash
/bin/rbash
/bin/false

However a search with "sudo apt-cache pkgnames <SHELL>" and "sudo dpkg -L <SHELL>", where SHELL is one of the aforementioned shells returned, that the following shells are not present on the system.

 /bin/csh
 /usr/bin/es
 /usr/bin/ksh
 /bin/ksh
 /usr/bin/rc
 /usr/bin/tcsh
 /bin/tcsh
 /usr/bin/esh

Is it safe to remove their entries in /etc/shells then? These shells arent used in "/etc/passwd" (login shells?).

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
A. Denton
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

You could backup the shells file, take the action you propose, then reboot.

If its no good and/or the system goes weird you can always copy the file back in live cd (if the system will not boot)

Its free to try, just make sure you can roll back if things go bad and you can do anything you like:

sudo cp /etc/shells /etc/shells_original

Should do the backup for you :)

Revision history for this message
A. Denton (aquina) said :
#2

actionparship thank you for your answer, but that's what I actually did not want to do.

I finally found the program /usr/sbin/remove-shell and some pointers (on a website) which confirmed my assumptions that /etc/shells should not contain inexistant shells for several reasons. Most notably for the reason to deny users from switching to an invalid chell via the «chsh» command. Furthermore I double checked the existance of these shells again with «apt-cache», «dpkg», via «Synaptic» and finally by performing a manual filesystem search with «find» and by using the graphical «xfe».

I'm quite sure that /etc/shells should be cleaned up whenever removing shells from the system. Correlation with «/etc/passwd» is advised since login-shells are defined here. Final note: I also removed «/usr/bin/screen» from the shells-file since that "shell" is not required for login. I also found online artiles mentioning that tclsh should not reside in the shells-file since it's not a fully qualified login shell.