Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
1  
@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

1 Answer 1

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-1.7.1.2/EXAMPLES:

// 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:172.16.181.130:2023

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

 
discard

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.