PariScamper的java天空

            BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
            14 Posts :: 0 Stories :: 7 Comments :: 0 Trackbacks

          2008年2月27日 #

          以下文章在我配置vsftpd時有幫助,特轉(zhuǎn)載:

          關(guān)于“vsftpd 部分本地用戶不能登錄,部分可以”的問題,我重新做了一些實驗,我把這個問題結(jié)合實驗的結(jié)果再重新描述一下,請各位高人,幫忙看看可能的原因。 謝謝了!

          系統(tǒng)中原來就有的本地帳號都不能登錄,我的/etc/vsftpd/vsftpd.conf文件的配置如下:
          local_enable=YES
          write_enable=YES
          chroot_local_user=YES
          pam_service_name=vsftpd
          /etc/pam.d/vsftpd存在且正常。

          登錄時錯誤信息都是一樣的:
          500 OOPS: cannot change directory:/home/xxxx
          Login failed.
          421 Service not available, remote server has closed connection

          他們的home目錄都是/home/xxxx。/home和/home/xxxx的權(quán)限都是755。
          以上這些帳號都不能ftp登錄,這些都是平常經(jīng)常使用的,可以用shell登錄的。

          我新創(chuàng)建了一個usr1帳號,
          # useradd -G test -d /tmp/usr1 usr1
          能ftp登錄,他的home為/tmp/usr1,在/分區(qū)上。而/home我是mount到/dev/hda9上的。
          #mount
          /dev/hdb1 on / type ext3 (rw)
          /dev/hda9 on /home type ext2 (rw)

          所以,我猜想:是否是由于/home分區(qū)的原因,而造成“主目錄在/home分區(qū)的帳號”都不能登錄呢?

          為了驗證以上設(shè)想,我試著再創(chuàng)建了一個帳號,
          useradd -G test -d /home/usr3 usr3
          /home, /home/usr3 的權(quán)限都是755。

          usr3 ftp登錄失敗。
          500 OOPS: cannot change directory:/home/usr3
          Login failed.
          421 Service not available, remote server has closed connection

          至此,我覺得可以確定是由于/home分區(qū)的原因,而造成“主目錄在/home分區(qū)的帳號”都不能登錄。
          參考文章:
          -----------------------------------------------------------------------------------------
          I finished my second upgrade to Fedora Core 4. Not everything is ironed out yet with the build of course. But one thing is for sure a lot has happened to the RedHat I knew before.

          I must say of all the changes, for me the nicest addition is the new SELinux extensions. For deep background on the reasons for and theory of SELinux read, The Inevitability of Failure: The Flawed Assumption of Security in Modern Computing Environments

          The more I work with SELinux the more I realize I need to know about it, and how exactly it does all its stuff. It certainly changes things relating to users, directories and access. As I am starting to learn it, I'm sure I'm doing things the hard-way. :)

          The major difference, so far for me, in Red Hat's SELinux is the way ftp is handled. vsftpd is still the server which is great. However, it seems to be designed to run as a daemon rather than invoked via xinet.d. If you grab a working copy of the xinet.d file for vsftpd you can invoke it via xinet.d wrapper. I did my first server upgrade in this manner. The current one I am trying as a daemon. I certainly think I will miss some of the features that the xinet.d wrapper brings, and may yet return to it.

          Of all the issues I saw most notable is if you want to enable chroot directory's outside of the normal /home/xxx vsftpd. These will fail with a

              500 OOPS: cannot change directory: /mnt/xxxxx

          I was able to use ftp if I logged in with an account with a directory in /home, but once I set a user account to have a home drive outside of /home (in this case on a mounted secondary disk) vsftpd barfs the above.


          I found information at the NSA that indicates you can disable SELinux protection of the ftp daemon.

              setsebool -P ftpd_disable_trans 1

          This seems a bit drastic. It certainly works for now though.

          I think ultimately the issue resides with policies, but as SELinux policies are new to me, it will take time before it all gets sorted out. As I spend time with the new SELinux extensions in Fedora Core 4 I will keep you updated on my thoughts and configuration lessons.


          ---------------------------------------------------------------------------------------

          解決辦法:
          --------------------------------------------------------------------------------------
           # setsebool ftpd_disable_trans 1
            # service vsftpd restart
          我用的是FC4,按照你上一帖子里的方法試了,馬上就解決了。所以,可以確定原因就在SELinux。
          ------------------------------------------------------------------------------------

          posted @ 2008-02-27 22:45 PariScamper 閱讀(453) | 評論 (0)編輯 收藏

          主站蜘蛛池模板: 永昌县| 九江市| 莱西市| 蒙自县| 盱眙县| 禄丰县| 四子王旗| 买车| 安达市| 沙洋县| 稻城县| 吴川市| 罗平县| 乐昌市| 兴文县| 喜德县| 长岛县| 嘉鱼县| 凤台县| 望都县| 乐东| 武鸣县| 黎川县| 吉木萨尔县| 神池县| 万州区| 安徽省| 渭南市| 宁国市| 永仁县| 明水县| 南雄市| 怀柔区| 枣阳市| 汉中市| 西青区| 永清县| 鸡西市| 定远县| 莱西市| 浠水县|