Try something like
mkfifo temp
nc -l 1234 < temp 2>&1 | /bin/sh > temp 2>&1
Question
I'm not really sure where to start. I'm supposed to use netcat to allow anyone to access my shell remotely in C. I know I need to need to use sockets, but not sure what else. Can anyone point me in the right direction. Basically when I execute the program, I want it to open "nc -l 1234", take in commands from the client and respond. Thanks.
Solution
Try something like
mkfifo temp
nc -l 1234 < temp 2>&1 | /bin/sh > temp 2>&1
OTHER TIPS
you can try
$nc -l 1234 -e /bin/bash -i (server)
$nc x.x.x.x 1234 (client)
We have created a netcat server and indicated it to run /bin/bash command when connection is successful.
This is a good reference for it . (using c)
http://www.cs.swarthmore.edu/~aviv/classes/f12/cs43/labs/lab4/lab4.pdf