Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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 need to run any "remote shell daemon" (ssh, telnet, netcat, socat... I don't mind) as non-root user. The remote shell should provide tab-completion and I want to be able to browse history using arrows.

I am currently using a netcat-based solution, but I loose tab-completion and I am unable to browse history using arrows

On server side :

# Run the "remote shell daemon"
$ mkfifo fifo
$ nc -l 2000 <fifo | /bin/bash &> fifo
$ rm fifo

On client side :

# Connect to the remote shell
$ nc $REMOTE_ADDR 2000

Adding the -i or -l argument to bash does not help.

share|improve this question
If you use ssh and your remote shell is properly configured then you should have tab-completion and history browsing. At least I have when I login to my server using Ubuntu 12.04 on both machines. – Anthon Apr 18 '13 at 12:42
I need to run a "remote shell" daemon as non-root user. Sshd typically runs as root. – Xion345 Apr 18 '13 at 12:43
As long as the config files and the keys are owned by the user running sshd, and you use a port number > 1024 you don't need to run sshd as root. – Anthon Apr 18 '13 at 13:05
Why do you need to run the daemon as a regular user? What are you trying to achieve? – terdon Apr 18 '13 at 13:32
@terdon : I use a computing grid and I don't have a shell access to all nodes of the grid. The only thing I can do is submit scripts to the system (it's Grid Engine), and they will be scheduled on the node I specified. I would like to write a script that would allow me to have a shell access to a node of the grid. – Xion345 Apr 18 '13 at 13:47
up vote 3 down vote accepted

socat(1) could be of some help.

From http://stuff.mit.edu/afs/sipb/machine/penguin-lust/src/socat-

// poor mans 'telnetd' replacement
# socat tcp-l:2023,reuseaddr,fork exec:/bin/login,pty,setsid,setpgid,stderr,ctty
// and here an appropriate client:
$ socat -,raw,echo=0 tcp:

Here, the example uses "login" which obviously requires a root access but I succesfully tested with /bin/zsh. This implies that security is not a problem... Otherwise, as they say in the webpage where I found out this tip, you could use a client authentication with SSL to make sure only you can actually log in.

share|improve this answer

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.