网站运营
位置:首页>> 网站运营>> 用Linux构建高效FTP服务器(4)

用Linux构建高效FTP服务器(4)

 来源:Asp之家 发布时间:2010-08-23 19:05:00 

标签:服务器,FTP,Linux

7.重新启动VSFTP

#service vsftpd restart

8.以虚拟用户gou(Linux中并无该账号)进行测试:

# ftp 127.0.0.1

Connected to 127.0.0.1 (127.0.0.1)。

220 Welcom to my FTP server.

Name (127.0.0.1:root): gou

331 Please specify the password.

Password:

230 Login successful. Have fun.

Remote system type is UNIX.

Using binary mode to transfer files.

测试下载服务器目录中的一个文件mytest:

ftp》 get mytest

local: mytest remote: mytest

227 Entering Passive Mode (127,0,0,1,159,19)

150 Opening BINARY mode data connection for mytest (21 bytes)。

226 File send OK.

21 bytes received in 0.00038 secs (54 Kbytes/sec)

测试上传本机目录中的文件vsftpd.conf:

ftp》 !ls

account.db chroot_list k mytest userconf vsftpd.conf

ftp》 put vsftpd.conf

local: vsftpd.conf remote: vsftpd.conf

227 Entering Passive Mode (127,0,0,1,117,203)

150 Ok to send data.

226 File receive OK.

4229 bytes sent in 0.00195 secs (2.1e+03 Kbytes/sec)

可以看到,使用没有系统账号的虚拟用户可以成功完成上传、下载的工作。但该FTP虚拟服务器只允许虚拟用户登录,其它系统用户无法登录,如系统用户user1不是虚拟用户,则不能登录该虚拟服务器。

# ftp 127.0.0.1

Connected to 127.0.0.1 (127.0.0.1)。

220 Welcom to my FTP server.

Name (127.0.0.1:root): user1

331 Please specify the password.

Password:

530 Login incorrect.

Login failed.

在虚拟FTP服务器中,也可以对各个用户的权限进行设置。方法是在/etc/vsftpd.conf文件中添加如下一行:

user_config_dir=用户配置文件目录

然后在用户配置文件目录下创建相应的用户配置文件,比如为上述名为gou的用户创建一个配置文件(假设配置文件目录为/etc/user_config_dir):

#vi /etc/user_config_dir/gou

write_enable=NO

anono_upload_enable=NO

重启FTP服务器,这时再使用账号gou来登录,就已经没有上传的权限

0
投稿

猜你喜欢

手机版 网站运营 asp之家 www.aspxhome.com