CentOS 5.3下vsftp创建新用户
最近刚学Linux,想要在Linux上配置一个ftp服务器,就用源码编译安装了一个2.1.2版本的vsftpd。安装过程还好,在配置的过程中就遇到了一些问题,以下配置过程及解决方法:1.方法一:
先创建一个系统用户,然后修改/etc/passwd文件
命令如下(mytest是用户名):
#先创建一个系统用户并设置密码
#useradd mytest
#passwd mytest
# 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文件# cd /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表示不能登录系统。方法二:直接使用命令:# useradd -d /home/mytest/ -g ftp -s /sbin/nologin mytest这样新用户就创建好了。不过,我在创建好用户后登陆时出现如下的提示:# 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文件夹的权限# ls -l mytestdrwxr-xr-x 2 root root 4096 08-10 15:32 mytest发现权限没设好,这里我使用drwxrwxrwx权限# chmod 777 mytest设置好权限后重启vsftpd # service vsftpd restart登陆后可能还会出现以上问题,这时可能是SELinux的问题,以下是解决方法: # setsebool -P ftpd_disable_trans 1这个是关于SELinux的设置,不了解,可能是让vsftpd通过SELinux,关于P选项的意思是长久生效,如果不加P选项的话,重启后可能还要使用命令setsebool -P ftpd_disable_trans 1来解决以上的问题。至此,新用户就创建完成并能够登陆使用了。# 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>
版权声明:本文为博主原创文章,未经博主允许不得转载。
页:
[1]