检查xinetd服务是否安装
lkmao@ubuntu:~$ ps au | grep xinetd
lkmao 2536 0.0 0.1 11760 2172 pts/0 S+ 06:17 0:00 grep --color=auto xinetd
lkmao@ubuntu:~$
保持虚拟机联网,安装xinetd服务
sudo apt install xinetd
xinetd的默认配置文件是/etc/xinetd.conf,查看这个配置文件的内容会发现,它将/etc/xinetd.d目录里的文件包含了进来。
/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
}
includedir /etc/xinetd.d
/etc/xinetd.d/目录中的内容
$ ls /etc/xinetd.d/
chargen daytime discard echo time
安装vsftpd
sudo apt install vsftpd
/etc/xinetd.d中创建文件 sudo touch proftpd
lkmao@ubuntu:/etc/xinetd.d$ sudo touch proftpd
在proftpd文件中输入内容
#default:on
#
service vsftpd
{
disable = no
port = 21
socket_type = stream
protocol = tcp
user = lkmao
server = /usr/sbin/vsftpd
type = UNLISTED
wait = no
}
上述配置的含义如下所述。 第1和第2行是注释行,不用管它。第3行是定义服务的名称为vsftpd。 第5行disable的意思是禁用,那么,disable=no就是启动。 第6行是指定该服务的端口,ftp的端口是21。如果不用21端口,可以根据vsftpd.conf文件做相应的改变。 第7行是socket的类型,这里设为stream(流)。 第8行是指定协议,这里设为tcp协议。 第9行是启动该服务的用户,设为lkmao。 第10行是指定运行文件的路径。 第12行是不等待至启动完成。
在编写完毕配置文件后,运行killall -HUP xinetd。然后使用ftp localhost登录进行测试,可以发现FTP程序已经可以登录了。
启动服务
sudo killall -HUP xinetd
登录测试
lkmao@ubuntu:~$ ftp 192.168.31.122
Connected to 192.168.31.122.
220 (vsFTPd 3.0.2)
Name (192.168.31.122:lkmao): lkmao
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
226 Directory send OK.
ftp>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)