Notes rsh rcp

Voir :

http://jlbicquelet.free.fr/aix/configuration/rsh.php

https://www.verylazytech.com/network-pentesting/rsh-port-514

Ne pas utilser ce truc

Use of rsh is discouraged due to the inherent insecurity of host-based authentication.

Source : man rsh

rsh : Ce programme est issu du package rlogin

Protocole

Ports

rsh hostname (port 513)
rsh hosname commande (port 514)

Coté serveur

Avec le compte root

apt-get install rsh-client rsh-server
/etc/init.d/openbsd-inetd status /etc/init.d/openbsd-inetd start /etc/init.d/openbsd-inetd status
echo "localhost" >> ~/.rhosts

/etc/hosts.equiv global trusted host-user pairs list

~/.rhosts per-user trusted host-user pairs list

rsh, rlogin et ssh utilisent ces fichiers

Syntaxe de .rhosts hosts.equiv

somehost
somehost username

Coté client

Avec le compte utilisateur

apt-get install rsh-client
echo plop > plop.txt rcp plop.txt root@localhost:/tmp/ rcp plop.txt localhost:/tmp/
rsh -l user localhost

Shell meta-characters escape

Shell meta-characters which are not quoted are interpreted on local machine, while quoted meta-characters are interpreted on the remote machine

Appends the remote file remotefile to the local file localfile

rsh otherhost cat remotefile >> localfile

Appends remotefile to other_remotefile

rsh otherhost cat remotefile ">>" other_remotefile

Autres

echo "rsh" >> /etc/securetty

Dans un conteners

# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 14:51 pts/0 00:00:00 /bin/sh
root 7 1 0 14:51 pts/0 00:00:00 bash
root 942 1 0 15:08 ? 00:00:00 /usr/sbin/inetd
root 1071 7 0 15:39 pts/0 00:00:00 ps -ef

# rsh localhost
rlogind[1078]: pam_rhosts(rlogin:auth): allowed access to root@localhost as root
#