Web lists-archives.com

Re: how to make sshd start a shell other than bash when I log in?




> > * Andrew Schulman (Thu, 06 Apr 2017 21:22:38 -0400)
> > > 
> > > My regular shell is fish. To make local terminals run fish instead of bash when
> > > I start them, I set
> > > 
> > > SHELL=/usr/bin/fish
> > > 
> > > in my desktop environment. This works fine: I start MinTTY, and fish starts.
> > > 
> > > But when I log into that same host by sshd, bash starts, not fish (since sshd
> > > doesn't have access to my desktop environment variables). How can I configure
> > > either my ssh client or the ssh server to start fish instead of bash?
> > 
> > I use db_shell in /etc/nsswitch.conf.
> 
> Hm. So this is documented in "The db_shell setting" at
> https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping-nsswitch. AFAICT, the
> only useful option there for my purposes is to set
> 
> db_shell = /bin/fish
> 
> After restarting sshd, this does make fish my login shell. Of course, it makes
> fish the login shell for every other user on the host too, but for single-user
> hosts such as mine, that works fine. Thanks.

Reading further on in the docs, to set the shell independently for different
users, in /etc/nsswitch.conf set

db_shell = desc

Then in an administrative shell, run e.g.

net user andrew /comment:'<cygwin shell="/bin/fish"/>'

Then restart sshd. Annoying that it has to be done administratively, but anyway
it works. Again thanks.

Andrew


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple