Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to encrypt a file on-the-fly, redirecting the output to a named pipe [fifo]. I SSH into my server and run the command:

           $ mcrypt -k key < file > named_pipe

then from my laptop I try to scp it:

           $ scp me@server:~/dir/named_pipe 

and it says

           scp: /users/home/me/dir/named_pipe: not a regular file

Is there any way to do this? Thanks

share|improve this question
I would assume that scp copies file content. A named pipe is not a physical file, hence scp won't try to copy it (try copying /dev/random, for example). Just redirect to a file, or find a way to tunnel the data to your laptop. – new123456 Aug 2 '11 at 1:28
up vote 3 down vote accepted

Stream from it instead.

ssh me@server cat ~/dir/named_pipe > file.out
share|improve this answer
So I finally got around to trying it out: this is what I get: Bus error: 10 (core dumped).. from mcrypt, and the "> file" file is emtpy. – Matt Aug 6 '11 at 2:26
Try streaming from the named pipe locally to see if mcrypt invokes a bus error even then. – Ignacio Vazquez-Abrams Aug 6 '11 at 2:57
Good call. I try it on a big file [900MB] and it seems to just sit there doing nothing [output being blank] So created a 5MB file from /dev/urandom, and tried encrypting to a regular file [no fifo]. And it invokes the bus error. :\ I try it on my local Ubuntu machine and it works fine. Maybe it's this server or freebsd? :\ Do you of any encryption program to output to stdout? – Matt Aug 6 '11 at 13:16
Unfortunately command-line encryption is not my forte; I usually leave that to GnuPG or OpenSSL. – Ignacio Vazquez-Abrams Aug 6 '11 at 17:38
Turns out, I don't need this anymore. However, your answer would have worked if mcrypt would work. :) – Matt Aug 6 '11 at 23:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.