Skip to main content
Welcome guest. | Register | Login | Post

mutt through ssh - single command?

6 replies [Last post]
tbuitenh's picture
Joined: 2005-12-21

I'm integrating a remote server into my desktop menus.

First thing I did was putting a .ssh/authorized_keys files so the server will recognize my computer and not ask me for a password. (Yes, this is secure, there's public key cryptography involved.)

Next step, add this to a menu:

command: ssh me@server
[X] run in terminal

Works fine, as expected. But I'd like things to be even a little easier...

command: ssh me@server mutt
[X] run in terminal

That gives me just a blank terminal. So does
ssh me@server 'bash -c mutt'

The reason is that commands run that way are noninteractive, they run in the foreground but are not attached to the terminal. So I try this:
(echo mutt ; cat) | ssh me@server

The result:
Pseudo-terminal will not be allocated because stdin is not a terminal.

Right. It's a pipe, of which the front end is a terminal but ssh doesn't know that and doesn't trust it for one reason or another.

Any ideas about how to avoid typing "mutt"?

free-zombie's picture
Joined: 2006-03-08
ssh -t host
ssh -t host program

forces PTY creation. I had this problem with screen and RTFM.

tbuitenh's picture
Joined: 2005-12-21
I did RTFM, but somehow

I did RTFM, but somehow managed to miss that option. Thanks.

Edit: by the way, I think the owner of the server knows who he is, screen would be nice Eye .

tbuitenh's picture
Joined: 2005-12-21
Additional hint: if you use

Additional hint: if you use ssh in the way described above, your bash (or other shell configuration) won't be read. This means that if you set the EDITOR environment variable there, you'll get the default editor anyway. Setting it in .ssh/rc won't help either, that script will be executed before the command but the environment variable will be discarded when it finishes (a UNIX security feature). This is the way to do it:

ssh -t me@server 'EDITOR=vim mutt'

libervisco's picture
Joined: 2006-05-04
Screen installed.

Screen installed. Smiling

tbuitenh's picture
Joined: 2005-12-21
Thanks, now I won't need

Thanks, now I won't need multiple connections when I start trying to get passiflora to run there. But first I need to get it to run on my own box again Laughing out loud .

Joined: 2006-01-02
I rely on a shell box a lot

I rely on a shell box a lot so I worked a lot of things that makes life easier.

I have a screen configuration that gives me a window listing at the bottom.
This screen configuration automatically starts: ssh to my shell, pends for an answer to start a local irssi, pends to start rtorrent, and mc. Each screen window is also named accordinly.

One thing I'd like to do is have a similar configuration on my shell that'll start IRSSI, mutt, and mc. Except I can't figure out how to read from a configuration file and attach if already initiated a previous session.

My current command is:

ssh -C -D8888 -t "screen -dR irssi irssi"

which is also aliased to:


or if I were to use my local screen configuration file:

screen -c misc/screenconf

I usually use the last two commands, for obvio