Install rsh under Ubuntu for passwordless access
- 2020-05-27 08:02:23
- OfStack
1. Environmental
1.3 servers ubuntu14.04, hostnames compute, block1 and blcok2, respectively
2. The hosts files of both hosts are:
root@compute:~# cat /etc/hosts
127.0.0.1 localhost
192.168.4.132 compute
192.168.4.133 block1
192.168.4.134 block2
2. Install rsh and rsh-server (all 3 hosts installed) and set up rsh and rlogin services to start
1 installation
apt-get install rsh-client rsh-server xinetd
2 ubuntu under the original no/etc/xinetd d/rsh file, and add new content
# default: on
# descr and ption: The rshd server is the server for the rcmd(3) routine and, \
# consequently, for the rsh(1) program. The server provides \
# remote execution facilities with authentication based on \
# privileged port numbers from trusted hosts.
service shell
{
disable = no
socket_type = stream
wait = no
user = root
log_on_success += USERID
log_on_failure += USERID
server = /usr/sbin/in.rshd
}
/etc/xinetd.d/rlogin
# default: on
# descr and ption: rlogind is the server for the rlogin(1) program. The server \
# provides a remote login facility with authentication based on \
# privileged port numbers from trusted hosts.
service login
{
disable = no
socket_type = stream
wait = no
user = root
log_on_success += USERID
log_on_failure += USERID
server = /usr/sbin/in.rlogind
}
/etc/xinetd.d/rexec
# default: off
# descr and ption: Rexecd is the server for the rexec(3) routine. The server \
# provides remote execution facilities with authentication based \
# on user names and passwords.
service exec
{
disable = no
socket_type = stream
wait = no
user = root
log_on_success += USERID
log_on_failure += USERID
server = /usr/sbin/in.rexecd
}
3 restart
root@block2:~# /etc/init.d/xinetd restart
xinetd stop/waiting
xinetd start/running, process 26181
3. Establish trust files and achieve password-free access configuration
1. Create a.rhosts file in the root home directory and write the hostnames of the two hosts in this file
root@block1:~# cat .rhosts
compute root
block1 root
block2 root
Note: root requires /root/.rhosts file for validation, while ordinary users require /etc/ hosts.equiv file
2. Create the hosts.equiv file in the /etc directory and write the hostname as the client host in this file
root@block1:~# cat /etc/hosts.equiv
# /etc/hosts.equiv: list of hosts and users that are granted "trusted" r
# command access to your system .
compute
3 in file /etc/securetty
Join rsh rlogin rexec
4. After configuration, verify the configuration
1. Directly enter rsh block1 date on compute server to execute date command without password on block1
root@compute:~# rsh block2 date
Thu Mar 30 16:38:42 CST 2017
2. Enter rsh block1 directly on compute to log in block1 without a password
3. Normal user operation is the same as root user
4. There is also the rcp command to remotely copy files
At this point, the rsh password-free access is configured.