今天在Fedora 12 下配置ftp的时候,按以前的步骤弄好后竟然本地用户无法登陆,整了很久都没解决问题,报错如下:
ftp 127.0.0.1
Connected to 127.0.0.1 (127.0.0.1).
220 Welcome to my fedora FTP service.
ftp> user stu1
331 Please specify the password.
Password:
500 OOPS: cannot change directory:/home/stu1
Login failed.
ftp> bye
500 OOPS: child died
黔驴技穷后只好请出万能的google,才知道原来所SELinux 搞的鬼,网络大部分提供的解决方法:
7^luj/he@0@:L%C0在终端输入命令:
xoX*eh.j0setsebool ftpd_disable_trans 1
但是我输入时候却出现了问题
[root@lin-fedora mnt]# setsebool ftpd_disable_trans 1
Could not change active booleans: Invalid boolean
可能所因为系统版本不同,无法执行,也就算说原理所一样的,就是命令的语法可能不一样
后来又搜到获取SELinux 设置项的指令,由此得到启发,最后果然如我所料,成了~
[root@lin-fedora ~]# getsebool -a | grep ftp
allow_ftpd_anon_write --> off
allow_ftpd_full_access --> off
allow_ftpd_use_cifs --> off
allow_ftpd_use_nfs --> off
ftp_home_dir --> off
ftpd_connect_db --> off
httpd_enable_ftp_server --> off
tftp_anon_write --> off
[root@lin-fedora ~]# setsebool ftp_home_dir on
[root@lin-fedora ~]# ftp 127.0.0.1
Connected to 127.0.0.1 (127.0.0.1).
220 Welcome to my fedora FTP service.
Name (127.0.0.1:lin): user stu1
331 Please specify the password.
Password:
530 Login incorrect.
Login failed.
ftp> user lin
331 Please specify the password.
Password:
230 Login successful.
ftp> ls
227 Entering Passive Mode (127,0,0,1,20,203).
150 Here comes the directory listing.
drwxr-xr-x 2 500 500 4096 Aug 04 04:53 Desktop
drwxr-xr-x 2 500 500 4096 Aug 03 11:09 Documents
drwxr-xr-x 2 500 500 4096 Aug 03 11:09 Downloads
drwxr-xr-x 2 500 500 4096 Aug 03 11:09 Music
drwxr-xr-x 2 500 500 4096 Aug 03 11:09 Pictures
drwxr-xr-x 2 500 500 4096 Aug 03 11:09 Public
drwxr-xr-x 2 500 500 4096 Aug 03 11:09 Templates
drwxr-xr-x 2 500 500 4096 Aug 03 11:09 Videos
226 Directory send OK.
ftp>
#####################################################
上午的Samba 服务器更纠结,同样也是因为SELinux 花了不少时间,在设置访问用户家目录的时候也所要用setsebool来打开SELinux 中的限制。不过这个还好在配置文件有说明
# Turn the samba_enable_home_dirs Boolean on if you want to share home
# directories via Samba. Run the following command as the root user to turn this
# Boolean on:
# setsebool -P samba_enable_home_dirs on
###
samba的挂载常用命令
mount -t cifs //ip addr/Public /mount/point -o username=xxxx