Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jdavidb (1361)

jdavidb
  (email not shown publicly)
http://voiceofjohn.blogspot.com/

J. David Blackstone has a Bachelor of Science in Computer Science and Engineering and nine years of experience at a wireless telecommunications company, where he learned Perl and never looked back. J. David has an advantage in that he works really hard, he has a passion for writing good software, and he knows many of the world's best Perl programmers.

Journal of jdavidb (1361)

Tuesday November 21, 2006
03:31 PM

How to get the shell you want

[ #31680 ]

Despite my best efforts, most people around here still don't know that they prefer bash. Which is odd, since this is where I learned to prefer bash.

I have my Cygwin .Xinitrc menus and ssh keys set up to give me instant right-click-and-select-a-host access to just about everything I need. Except that for most of the servers I've added recently, that takes me somewhere where the shell is not bash, and where I'm not the account owner and/or don't have what I need to get bash set up as the default shell.

For awhile I've been considering putting something in the login files to examine the SSH_CLIENT variable and exec bash when the IP address looks like mine. But that sounds a little fragile and therefore scary: what if somebody else using one of these accounts gets my bash config and doesn't want it? What if it breaks completely, when someone else is accessing the account, and they can't even get a regular shell and have no idea what happened?

I'd previous tried ssh user@host bash, but that didn't seem to work. For some reason, it seemed to take forever, even though executing other arbitrary commands through ssh worked just fine.

So today I tried it again, and then I typed something and hit enter while ssh was "taking forever." And I discovered ssh wasn't taking forever -- it had logged in and started a bash for me, which was executing in batch mode or something, with no prompt. I got the same result trying to run other shells, actually.

So I dug through the ssh manpage and found out that if I pass the -t option, ssh will allocate a tty for the connection, which causes bash to realize it is supposed to be running interactively, and everything works fine! .XWinrc updated!

While writing this entry, I decided to check to see if there were an option I could pass to bash to just tell it to be an interactive shell. I had previously tried bash --login, and that didn't work. Turns out you can specify an interactive shell with the -i option, but that won't do you a lot of good if you aren't using a tty, because the input and output will be in raw mode instead of cooked. You'll get a lot of junk echoed.

Now I just need to figure out why I can't sudo - user bash on some hosts.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.