服务器之家:专注于服务器技术及软件下载分享
分类导航

Linux|Centos|Ubuntu|系统进程|Fedora|注册表|Bios|Solaris|Windows7|Windows10|Windows11|windows server|

服务器之家 - 服务器系统 - Ubuntu - Ubuntu下安装rsh实现无密码访问详解

Ubuntu下安装rsh实现无密码访问详解

2022-01-06 15:42翟海飞 Ubuntu

这篇文章主要为大家详细介绍了Ubuntu下安装rsh实现无密码访问的相关资料,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

一、环境

1.三台服务器ubuntu14.04, 主机名分别为compute,block1和blcok2

2.两台主机hosts文件都为:
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

二、安装rsh和rsh-server(三台主机都安装),并设置启动rsh和rlogin服务

1 安装

?
1
apt-get install rsh-client rsh-server xinetd

2 ubuntu下原来没有/etc/xinetd.d/rsh文件,新建并添加内容

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# default: on
# descrī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ī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ī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 重启动

?
1
2
3
root@block2:~# /etc/init.d/xinetd restart
xinetd stop/waiting
xinetd start/running, process 26181

三、建立信任文件,实现无密码访问配置

1.在root主目录下建立.rhosts文件,并在此文件内写入这两台主机的主机名

?
1
2
3
4
root@block1:~# cat .rhosts 
compute root
block1 root
block2 root

注:root 验证需要/root/.rhosts文件,普通用户需要/etc/hosts.equiv文件

2.在/etc目录下建立hosts.equiv文件,并在此文件内写入作为客户端主机的主机名

?
1
2
3
4
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 在文件/etc/securetty中

加入rsh rlogin rexec

四、配置完毕,验证配置

1.在compute服务器上直接输入rsh block1 date就可以在block1上无密码执行date命令

?
1
2
root@compute:~# rsh block2 date
Thu Mar 30 16:38:42 CST 2017

2.在compute上直接输入rsh block1就可以无密码登录block1
3.普通用户操作同root用户
4.还有rcp命令可以远程复制文件
至此rsh无密码访问配置完毕。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。

延伸 · 阅读

精彩推荐
  • UbuntuWSL、WSL2与Ubuntu性能大PK

    WSL、WSL2与Ubuntu性能大PK

    科技媒体 Phoronix 对 Windows 10 May 2020 中 WSL 和 WSL 2 的性能进行了测试,参与测试的发行版为 Ubuntu 20.04 on WSL/WSL2 ,以及 Ubuntu 20.04 LTS,均被安装在除 Windows 之...

    开源中国29412020-06-23
  • UbuntuUbuntu17.10怎么添加日历事项? Ubuntu添加行程提醒的教程

    Ubuntu17.10怎么添加日历事项? Ubuntu添加行程提醒的教程

    Ubuntu17.10怎么添加日历事项?Ubuntu17.10系统中有一个日程管理功能,可以在日历中添加行程提醒,下面我们就来看看Ubuntu添加行程提醒的教程,需要的朋友可...

    服务器之家2812019-06-19
  • UbuntuUbuntu20.04开启root账户的方法步骤

    Ubuntu20.04开启root账户的方法步骤

    这篇文章主要介绍了Ubuntu20.04开启root账户的方法步骤,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们...

    缀梦13002020-08-01
  • Ubuntu如何在ubuntu系统中安装pycharm工具并运行

    如何在ubuntu系统中安装pycharm工具并运行

    在Windows系统中安装pycharm,只需要下载安装包,然后根据指令一步一步操作;而在Linux系统中的Ubuntu中安装pycharm,需要下载安装包,还有安装相关的其他软件...

    百度经验12082019-10-21
  • UbuntuUbuntu 15.04升级到Ubuntu 15.10的详细教程

    Ubuntu 15.04升级到Ubuntu 15.10的详细教程

    ubuntu15.04怎么升级到ubuntu15.10?又该升级系统了,但是很多人对ubuntu系统很不熟悉,下面我们一起来看看ubuntu15.04升级ubuntu15.10的详细教程,需要的朋友可以...

    服务器之家4562019-07-02
  • UbuntuUbuntu Gnome下如何修改应用图标icon?

    Ubuntu Gnome下如何修改应用图标icon?

    最近有些朋友问小编Ubuntu Gnome下如何修改应用图标icon?今天小编要为大家分享的是Ubuntu Gnome下修改应用图标icon的方法;有需要的朋友一起去看看吧...

    服务器之家6412019-06-01
  • UbuntuUbuntu下安装Chrome的方法分享

    Ubuntu下安装Chrome的方法分享

    本文给大家分享的是Ubuntu下安装Chrome的方法,安装的过程中发现还是挺麻烦的,就记录下来推荐给大家,有需要的小伙伴可以参考下。...

    Ubuntu教程网3862021-10-25
  • UbuntuUbuntu安装和卸载CUDA和CUDNN的实现

    Ubuntu安装和卸载CUDA和CUDNN的实现

    这篇文章主要介绍了Ubuntu安装和卸载CUDA和CUDNN的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们...

    夜雨飘零14632020-08-04