vsftpd 550 Permission denied.

来源:互联网 发布:新疆的网络怎么了 编辑:程序博客网 时间:2024/05/06 12:57

1.vsftpd的匿名用户默认只支持下载权限

[root@localhost /]# ftp 127.0.0.1 测试ftp用匿名用户登陆到本地服务器
Connected to 127.0.0.1.
220 (vsFTPd 2.0.5)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (127.0.0.1:root): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>                登陆成功(默认vsftp是开启匿名登录)
 
接下来测试匿名用户上传与下载
 
[root@localhost ~]# touch /var/ftp/pub/test.txt 先在匿名用户下载目录创建一个test.txt文件
[root@localhost /]# cd root
[root@localhost ~]# touch test1.txt  进入根目录创建一个test1.txt文件,作为上传测试
ftp> cd pub
ftp> ls
227 Entering Passive Mode (127,0,0,12,92,5)
150 Here comes the directory listing.
-rw-r--r--    1 0        0               6 Dec 28 14:59 test.txt
226 Directory send OK.
ftp> mget test.txt 下载text.txt
mget test.txt?
227 Entering Passive Mode (127,0,0,12,123,33)
150 Opening BINARY mode data connection for test.txt (6 bytes).
226 File send OK.
6 bytes received in 0.0047 seconds (1.2 Kbytes/s)
ftp> !ls 测试是否下载到本地
anaconda-ks.cfg  install.log  install.log.syslog  test1.txt  test.txt 下载成功
ftp> put test1.txt 上传test1.txt
local: test1.txt remote: test1.txt
200 PORT command successful. Consider using PASV.
550 Permission denied.  请求被拒绝,说明没有上传权限
ftp> delete test.txt
550 Permission denied.  请求被拒绝,说明没有删除权限
 

2.让匿名用户支持上传功能,下载,创建目录文件的权限

 
要实现这个功能,必须做三件事情(测试环境是在关闭selinux情况下)
 

1)修改/etc/vsftpd/vsftpd.conf---à去掉注释

anon_upload_enable=YES

2)修改/etc/vsftpd/vsftpd.conf---à去掉注释

anon_mkdir_write_enable=YES

以上两个步骤如下:
 
[root@localhost ~]# vi /etc/vsftpd/vsftpd.conf    
25 # has an effect if the above global write enable is activated. Also, you will
     26 # obviously need to create a directory writable by the FTP user.
     27 anon_upload_enable=YES
     28 #
     29 # Uncomment this if you want the anonymous FTP user to be able to create
     30 # new directories.
     31 anon_mkdir_write_enable=YES
     32 #
     33 # Activate directory messages - messages given to remote users when they
     34 # go into a certain directory.
     35 dirmessage_enable=YES
 

3)文件系统中FTP匿名用户对某个目录有写权限

 
[root@localhost ~]# cat /etc/passwd |grep ftp
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologinà/var/ftp ftp用户的家目录 /sbin/nologin 不支持系统登录,只能作为虚拟用户用来登录vsftpd
 
创建一个名为put目录,并定义这个文件的所有者为ftp
 
[root@localhost ftp]# mkdir put
[root@localhost ftp]# chown ftp put 修改文件所有者为ftp
[root@localhost ftp]# ll
总计 8
drwxr-xr-x 2 root root 4096 2007-12-13 pub
drwxr-xr-x 2 ftp  root 4096 12-29 18:13 put
 
[root@localhost ftp]#  service vsftpd restart 重启vsftpd服务
关闭vsftpd:                                             [确定]
为vsftpd启动vsftpd:                                     [确定]
 
提示要想让匿名用户支持删除和更名权限,必须在vsftpd.conf加入以下参数
anon_other_write_enable=YES  允许匿名账号具有删除.更名权限
 [挂载人]初学MPEG [审核人]初学MPEG推荐

个人签名--------------------------------------------------------------------------------

 

Please Login (orSign Up) to leave a comment

原创粉丝点击