CentOS 5.3下vsftp建立新使用者

來源:互聯網
上載者:User

最近剛學Linux,想要在Linux上配置一個ftp伺服器,就用源碼編譯安裝了一個2.1.2版本的vsftpd。安裝過程還好,在配置的過程中就遇到了一些問題,以下配置過程及解決方案:

 

1.方法一:

先建立一個系統使用者,然後修改/etc/passwd檔案

命令如下(mytest是使用者名稱):

#先建立一個系統使用者並設定密碼

[root@localhost home]#useradd mytest

[root@localhost home]#passwd mytest

[root@localhost home]# passwd mytest

Changing password for user mytest.

New UNIX password:

BAD PASSWORD: it is based on a dictionary word

Retype new UNIX password:

passwd: all authentication tokens updated successfully.

這樣設定後的使用者有系統許可權,通過下面的方法來去除使用者的系統許可權

#修改/etc/passwd檔案[root@localhost etc]# cd /etc[root@localhost etc]# vi passwd#找到剛才添加的使用者(mytest)並修改如下,之前要確保檔案夾/home/mytest已存在mytest:x:501:50:Test ftp user:/home/mytest/:/sbin/nologin其中,mytest表示使用者名稱;x表示加密;500表示UID;50表示GID,這裡50表示FTP組;Test ftp user表示對使用者的說明;/home/testftp表示使用者的主目錄;/bin/nologin表示不能登入系統。方法二:直接使用命令:[root@localhost etc]# useradd -d /home/mytest/ -g ftp -s /sbin/nologin mytest這樣新使用者就建立好了。不過,我在建立好使用者後登陸時出現如下的提示:[root@localhost etc]# ftp localhostConnected to localhost.localdomain.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 typeName (localhost:root): mytest331 Please specify the password.Password:500 OOPS: cannot change directory:/home/mytestLogin failed.這裡是解方法:首先,檢查一下mytest檔案夾的許可權[root@localhost home]# ls -l mytestdrwxr-xr-x 2 root    root    4096 08-10 15:32 mytest發現許可權沒設好,這裡我使用drwxrwxrwx許可權[root@localhost home]# chmod 777 mytest設定好許可權後重啟vsftpd [root@localhost home]# service vsftpd restart登陸後可能還會出現以上問題,這時可能是SELinux的問題,以下是解決方案: [root@localhost home]# setsebool -P ftpd_disable_trans 1這個是關於SELinux的設定,不瞭解,可能是讓vsftpd通過SELinux,關於P選項的意思是長久生效,如果不加P選項的話,重啟後可能還要使用命令setsebool -P ftpd_disable_trans 1來解決以上的問題。至此,新使用者就建立完成並能夠登陸使用了。[root@localhost home]# ftp localhostConnected to localhost.localdomain.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 typeName (localhost:root): mytest331 Please specify the password.Password:230 Login successful.Remote system type is UNIX.Using binary mode to transfer files.ftp>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.