Talk:Shell
Ninereasons (Talk | contribs) (→What is a login shell?) |
Ninereasons (Talk | contribs) (→What is a login shell?) |
||
Line 43: | Line 43: | ||
Useless, but interesting, eh? Here, the user's login shell is <code>/usr/local/bin/python</code>. Needless to say, that file is not listed in <code>/etc/shells</code>. When does FreeBSD use the shell database, if logged in as root? Maybe Linux works the same, but I just never noticed? — [[User:Ninereasons|Ninereasons]] 13:07, 7 June 2006 (EDT) | Useless, but interesting, eh? Here, the user's login shell is <code>/usr/local/bin/python</code>. Needless to say, that file is not listed in <code>/etc/shells</code>. When does FreeBSD use the shell database, if logged in as root? Maybe Linux works the same, but I just never noticed? — [[User:Ninereasons|Ninereasons]] 13:07, 7 June 2006 (EDT) | ||
+ | |||
+ | : It's true. I never noticed. Linux works just like this also. So, lftp, or cpan or the like, could be my login shell. Weird. [[User:Ninereasons|Ninereasons]] 02:48, 9 June 2006 (EDT) |
Revision as of 01:48, 9 June 2006
What is a login shell?
I was a Slackware user for some time, before finding FreeBSD. One of the things that surprised me was that FreeBSD seems to be fuzzier about what a login shell is. Slackware, and I suppose any linux, has a shell database (/etc/shells
). If you attempt to assign a shell to a user, to provide their login shell, it must exist in the shell database. As far as I can tell, there is no such restriction in FreeBSD even though it also has a shell database. In fact, (as root
) any program at all can be substituted for a shell in the Shell field of the user's login profile (/etc/passwd
), as long as it exists in the global PATH (only root can specify non-standard shells - such as /usr/sbin/nologin
).
%grep python /etc/passwd pylogin:*:2011:2011:Login to python:/home/pylogin:/usr/local/bin/python
I don't know what might be the full implications; but it is somewhat surprising that it's possible to have a ssh session that looks like this:
Using username "pylogin". Using keyboard-interactive authentication. Password: Last login: Wed Jun 7 09:37:40 2006 from kanga Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD 6.1-STABLE (GENERIC) #10: Mon Jun 5 09:57:27 PDT 2006 Welcome to FreeBSD AMD64! Python 2.4.3 (#2, Apr 6 2006, 15:45:31) [GCC 3.4.4 [FreeBSD] 20050518] on freebsd6 Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> keys = os.environ.keys() >>> for val in keys: ... print val,": ",os.environ[val] ... TERM : xterm SHELL : /usr/local/bin/python MAIL : /var/mail/pylogin BLOCKSIZE : K FTP_PASSIVE_MODE : YES SSH_TTY : /dev/ttyp5 SSH_CLIENT : 192.168.1.3 3173 22 LOGNAME : pylogin USER : pylogin HOME : /home/pylogin PATH : /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/home/pylogin/bin SSH_CONNECTION : 192.168.1.3 3173 192.168.1.5 22 >>> ^d
Useless, but interesting, eh? Here, the user's login shell is /usr/local/bin/python
. Needless to say, that file is not listed in /etc/shells
. When does FreeBSD use the shell database, if logged in as root? Maybe Linux works the same, but I just never noticed? — Ninereasons 13:07, 7 June 2006 (EDT)
- It's true. I never noticed. Linux works just like this also. So, lftp, or cpan or the like, could be my login shell. Weird. Ninereasons 02:48, 9 June 2006 (EDT)