centos yum安裝ftp 及解決vsftp錯誤500 OOPS: cannot changedirectory:/home/**
1.查看服務器有沒有安裝ftp包
rpm -qa |grep vsftp
2.yum 安裝
yum -y install vsftpd
3.啓動vsftp的服務
service vsftpd start
4.關閉防火牆
service iptables stop
5.測試匿名訪問
修改配置文件 vsftpd.conf
[root@localhost vsftpd]# ls
ftpusers user_list vsftpd.conf vsftpd_conf_migrate.sh
[root@localhost vsftpd]#vi vsftpd.conf
把配置文件裏面的
# Uncomment this to allow the anonymous FTP user to uploadfiles. 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.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be ableto create
# new directories.
#anon_mkdir_write_enable=YES
#號給掉
然後保存重啓服務
6.添加用戶測試
useradd -m -d /home/test -s/bin/sh -g root test
passwd test 123456
useradd [-u uid | -g group] | -d dir | -s shell | -c comment | -m [-k skel_dir] ] login
說明:
u 指定用戶ID號
g 制定所在組
d 指定用戶目錄
s 制定用戶SHELL
c 用戶的註釋
m 建立用戶目錄
login 用戶的登錄名
useradd 參數有必要看一下
重啓服務測試登錄報錯
500 OOPS: cannot change directory:/home/test
修改/home/ 權限
chomd 777 /home/ 依舊是此錯誤
查看資料修改selinux
[root@localhost ~]# cat /etc/selinux/config
# This file controls the state of SELinux on thesystem.
# 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
[root@localhost ~]#
selinxu=enforcing 改成 selinux=disabled
然後必須重啓服務器
測試
登錄用戶爲 test 密碼爲123456
測試成功!