搜外网>搜外问答>问答页面

阿里云windows 系统轻量行服务器上面搭建FTP呢? 悬赏1元 已结束

<p>我scjinyijia.com 这个域名想搭建一个ftp 服务器是阿里云的轻量型服务器,我以前是从万网解析过来的,但是我实例栏目啥都没有(图1)</p><p><br></p><p></p><p>然后我想搭建一个FTP,使用了远程链接(图2)结果是;我应该什么样做,求高手提点。解决我这个SEO新手的苦。</p><p><br></p><p></p>

追加问题
    3 人参与回答

你还没有创建实例吧,新人对服务器配置不熟,建议使用PHPstudy之类的集成软件包,环境什么的一键搞定。具体可以参见这篇文章

个人建议:使用linux系统,虽然都说win是可视化的,但是安全性以及执行效率还是差了点,使用Linux一样可以实现可视化,安装一个宝塔面板就可以了。具体可以自行了解下。有其他问题可以给我留言。

划过人间的剑魂
划过人间的 · 客观剖析;控制台,餐饮店友链滴滴

可以加个QQ或微信吗,你这样说我不太懂

崔家大院
崔家大院 · 网站诊断、建站、快速排名

一、修改默认的防火墙firewal为iptables

我在搭建ftp服务器的过程中,总是不成功,然后把防火墙换了以后,就莫名其妙的可以了,所以这里需要把防火墙换一下。 

1、关闭原来的防火墙

systemctl stop  #停止firewall

systemctl disable  #禁止firewall开机启动

1

2

3

2、安装iptables

yum -y install iptables-services

1

3、将iptables设置为开机启动

systemctl enable  #设置防火墙开机启动

1

4、我们既然要使用iptables,我们就需要配置防火墙可以通行的端口,一下是放行端口的方法: 

首先打开配置文件:vim /etc/sysconfig/iptables 

然后添加通行端口,例如:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

1

最后重新启动防火墙,使配置生效

systemctl restart  #重启防火墙使配置生效

1

二、安装vsftpd和修改相关的配置文件

1、通过yum安装vsftpd

yum install -y vsftpd

1

2、修改vsftpd的配置文件

vim /etc/vsftpd/

1

关于如何配置,这里只是关于我的配置,应该按照自己的要求自行修改:

# Example config file /etc/vsftpd/

#

# The default compiled in settings are fairly paranoid. This sample file

# loosens things up a bit, to make the ftp daemon more usable.

# Please see  for all compiled in defaults.

#

# READ THIS: This example file is NOT an exhaustive list of vsftpd options.

# Please read the  manual page to get a full idea of vsftpd's

# capabilities.

#

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).

anonymous_enable=NO

#

# Uncomment this to allow local users to log in.

# When SElinux is enforcing check for SE bool ftp_home_dir

local_enable=YES

#

# Uncomment this to enable any form of FTP write command.

write_enable=YES

#

# Default umask for local users is 077. You may wish to change this to 022,

# if your users expect that (022 is used by most other ftpd's)

local_umask=022

#

# Uncomment this to allow the anonymous FTP user to upload files. This only

# has an effect if the above global write enable is activated. Also, you will

# obviously need to create a directory writable by the FTP user.

# When SELinux is enforcing check for SE bool allow_ftpd_anon_write, allow_ftpd_full_access

#anon_upload_enable=YES

#

# Uncomment this if you want the anonymous FTP user to be able to create

# new directories.

#anon_mkdir_write_enable=YES

#

# Activate directory messages - messages given to remote users when they

# go into a certain directory.

dirmessage_enable=YES

#

# Activate logging of uploads/downloads.

xferlog_enable=YES

#

# Make sure PORT transfer connections originate from port 20 (ftp-data).

connect_from_port_20=YES

#

# If you want, you can arrange for uploaded anonymous files to be owned by

# a different user. Note! Using "root" for uploaded files is not

# recommended!

#chown_uploads=YES

#chown_username=whoever

#

# You may override where the log file goes if you like. The default is shown

# below.

#xferlog_file=/var/log/xferlog

#

# If you want, you can have your log file in standard ftpd xferlog format.

# Note that the default log file location is /var/log/xferlog in this case.

xferlog_std_format=YES

#

# You may change the default value for timing out an idle session.

#idle_session_timeout=600

#

# You may change the default value for timing out a data connection.

#data_connection_timeout=120

#

# It is recommended that you define on your system a unique user which the

# ftp server can use as a totally isolated and unprivileged user.

#nopriv_user=ftpsecure

#

# Enable this and the server will recognise asynchronous ABOR requests. Not

# recommended for security (the code is non-trivial). Not enabling it,

# however, may confuse older FTP clients.

#async_abor_enable=YES

#

# By default the server will pretend to allow ASCII mode but in fact ignore

# the request. Turn on the below options to have the server actually do ASCII

# recommended for security (the code is non-trivial). Not enabling it,

# however, may confuse older FTP clients.

#async_abor_enable=YES

#

# By default the server will pretend to allow ASCII mode but in fact ignore

# the request. Turn on the below options to have the server actually do ASCII

# mangling on files when in ASCII mode.

#

# You may activate the "-R" option to the builtin ls. This is disabled by

# default to avoid remote users being able to cause excessive I/O on large

Sites. However, some broken FTP clients such as "ncftp" and "mirror" assume

# the presence of the "-R" option, so there is a strong case for enabling it.

#ls_recurse_enable=YES

#

# When "listen" directive is enabled, vsftpd runs in standalone mode and

# listens on IPV4 sockets. This directive cannot be used in conjunction

# with the listen_IPV6 directive.

listen=YES

#

# This directive enables listening on IPv6 sockets. By default, listening

# on the IPv6 "any" address (::) will accept connections from both IPv6

# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6

# sockets. If you want that (perhaps because you want to listen on specific

# addresses) then you must run two copies of vsftpd with two configuration

# files.

# Make sure, that one of the listen options is commented !!

#listen_ipv6=YES

pam_service_name=vsftpd

userlist_enable=YES

tcp_wrAPPers=YES

pasv_min_port=61001

pasv_max_port=62000

allow_writeable_chroot=YES

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

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

想要详细了解配置的可以参考:史上最详细的vsftpd配置文件讲解 

3、在根目录下创建一个访问ftp服务器时访问的文件夹(这里在那创建都可以)

mkdir /ftpfile

1

4、添加匿名用户(不要忘了用passwd设置密码)

useradd ftpuser -d /ftpfile(自己的文件夹) -s /sbin/nologin

1

5、修改ftpfile文件夹权限

chown -R  /ftpfile

1

6、将我们的用户添加到chroot_list中

vim /etc/vsftpd/chroot_list

1

添加创建的用户ftpuser,然后保存退出 

7、将SELinux关闭

vim /etc/selinux/config

1

修改SELINUX=disabled

三、让防火墙通行ftp相关的端口

在防火墙配置文件中添加:

-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8009 -j ACCEPT

-A INPUT -p TCP --dport 61001:62000 -j ACCEPT

-A OUTPUT -p TCP --sport 61001:62000 -j ACCEPT

1

2

3

4

5

6

4、访问

这里的文件夹就是我们的ftpfile,我在其中添加了一些文件,还有就是我用的域名访问,如果没有域名,可以用ip访问 

--------------------- 

作者:阿古拉斯啦啦 

来源:CSDN 

原文: 

版权声明:本文为博主原创文章,转载请附上博文链接!

SEO培训招生中
189