验证 Ubuntu11.10 安装telnet ssh ftp 软件

来源:互联网 发布:mac百度网盘上传速度慢 编辑:程序博客网 时间:2024/05/22 13:23
roothomes验证 Ubuntu11.10 安装telnet ssh ftp 软件
Ubuntu11.10  配置Telnet、SSH、FTP
[注意]为了避免出现不必要的问题,请使用root用户执行以下操作。
若root用户还没有设置密码,请先设置root用户的密码。
设置密码:$ sudo passwd root
切换用户:$ su - root

1:[配置Telnet远程连接服务]
声明:telnet连接是不加密的,远不如SSH安全,所以十分推荐不使用Telnet服务。
1.1:安装xinetd 以及telnetd
$ apt-get install xinetd telnetd
1.2:配置文件
修改【xinetd.conf】
$ gedit /etc/xinetd.conf

# Simple configuration file for xinetd
#
# Some defaults, and include /etc/xinetd.d/

defaults
{

    # Please note that you need a log_type line to be able to use log_on_success
    # and log_on_failure. The default is the following :
    # log_type = SYSLOG daemon info
    instances = 60                     
    log_type = SYSLOG authpriv         
    log_on_success = HOST PID          
    log_on_failure = HOST              
    cps = 25 30                        
}


1.3:修改【telnet】
$ gedit /etc/xinetd.d/telnet
添加如下内容:
# default: on
# description: The telnet server serves telnet sessions; it uses \
# unencrypted username/password pairs for authentication.
service telnet
{
    disable = no
    flags = REUSE
    socket_type = stream
    wait = no
    user = root
    server = /usr/sbin/in.telnetd
    log_on_failure += USERID
}  

1.4: 重启机器或重启网络服务
$ sudo /etc/init.d/xinetd restart


1.5: 允许root用户登入
备注: Telnet 不是很安全,默认不允许root以telnet进入主机 。
1.5.1: 修改【login】文件
$ gedit /etc/pam.d/login
auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so
 #将这一行加上注释!
1.5.2: 编辑【securetty】文件
$ gedit /etc/securetty
加上下面几行:

pts/0
pts/1
pts/2
pts/3
1.5.3:重启服务
$ sudo /etc/init.d/xinetd restart
然后测试root是否可以使用telnet服务登录。


2 : 配置SSH远程连接服务
2.1安装
$ sudo apt-get install openssh-server
Ubuntu 11.10已经默认安装了客户端  $ sudo apt-get install openssh-client
备注: 安装完成后,使用putty、SecureCRT、SSH Secure Shell Client等SSH 客户端软件连接,使用OS的用户名和密码登录。
2.2 :配置sshd_conf文件
$ gedit /etc/ssh/sshd_config
常用配置如下:
Port 22                
ListenAddress 0.0.0.0   
ClientAliveInterval 60 
ClientAliveCountMax 60 
#设置监听端口
#设置监听IP
#定义了每隔多少秒给SSH客户端发送一次信号
#定义了超过多少秒后断开与ssh客户端连接,设置ssh会话的超时时间。单位秒。

2.3:启停服务
重启ssh服务:$ sudo /etc/init.d/ssh restart
启动ssh服务:$ sudo /etc/init.d/ssh start
停止ssh服务:$ sudo /etc/init.d/ssh stop

3: 配置FTP服务

如果需要往服务器上传输文件而不是要共享文件的话,那么如果你配置好SSH就可以了,而且要更加的安全。
使用WinSCP或其他类似的客户端软件,就可以传输文件了。

如果是需要用FTP共享文件的话,请参考以下内容。
$ apt-get install vsftpd
$ useradd -m ftp
$ passwd ftp
$ mkdir /home/ftp
$chmod 777 /home/ftp

3.2:配置vsftpd.conf文件
$ gedit /etc/vsftpd.conf

listen=YES                #独立模式启动
max_clients=200
max_per_ip=4              #同时允许4客户端连入,每个IP最多5个进程
anonymous_enable=NO       #不允许匿名用户访问,允许本地(系统)用户登录
local_enable=YES
write_enable=YES
connect_from_port_20=YES  #是否采用端口20进行数据传输
xferlog_enable=YES        #生成日志
local_root=/home/ftp      #指定登录转向目录

3.3:重启FTP服务
$ /etc/init.d/vsftpd restart
原创粉丝点击