---
title: "vsftpd 500 OOPS: cannot change directory"
author: "andyniu"
date: "2013-08-26T21:49:28Z"
tags: []
categories: ["操作系统"]
slug: "vsftpd-500-oops-cannot-change-directory"
draft: false
lastmod: "2013-09-09T16:15:02Z"
id: 1931246
url: "https://andyniu.iteye.com/blog/1931246"
---

今天有台机器由于hang住了进行重启，重启之后发现ftp不好使，开始以为是ftp服务不随机器一起启动，结果就 重启了下。不过问题还是没解决，依然不好使，报500 OOPS: cannot change directory 这个错误。铜鼓半天，才发现由于selinux原因。

先输入/usr/sbin/getenforce  
如果是Enforcing，则表示有问题

进入到/etc/selinu/下。查看config文件，发现

\# This file controls the state of SELinux on the system.  
\# SELINUX= can take one of these three values:  
#     enforcing - SELinux security policy is enforced.  
#     permissive - SELinux prints warnings instead of enforcing.  
#     disabled - No SELinux policy is loaded.  
SELINUX=enforcing  ---多出了一行，这行与下面一样，而且这样赋值是错的。就注释掉了  
\# SELINUXTYPE= can take one of these two values:  
#     targeted - Targeted processes are protected,  
#     mls - Multi Level Security protection.  
SELINUXTYPE=targeted  
SELINUX=disabled

 

更改之后，由于暂时不能重启机器，就用setenforce 0  让它暂时生效。

 

后来仔细查百度才知道

SELINUX有「disabled」「permissive」，「enforcing」3种选择。

Disabled就不用说了，permissive就是Se[linux](http://baike.baidu.com/view/1634.htm)有效，但是即使你违反了策略的话它让你继续操作，但是把你的违反的内容记录下来。在我们开发策略的时候非常的有用。

相当于Debug模式。

Enforcing就是你违反了策略，你就无法继续操作下去。

SELINUXTYPE呢，现在主要有2大类，一类就是[红帽子](http://baike.baidu.com/view/161192.htm)开发的targeted，它只是对于，主要的[网络服务](http://baike.baidu.com/view/1279152.htm)进行保护，比如 apache,sendmail,bind,postgresql等，不属于那些domain的就都让他们在unconfined\_t里，可导入性高，可用性好但是不能对整体进行保护。