背景:由于云平台上22端口不对外放开,sftp使用不了,故选择ftp服务
操作系统版本:
上传ftp包、安装ftp服务:
[root@oracle-linux6 tmp]# ll 总用量 172 drwx------. 2 root root 16384 8月 2 17:39 lost+found -rw-r--r-- 1 root root 158772 3月 22 2017 vsftpd-2.2.2-24.el6.x86_64.rpm [root@oracle-linux6 tmp]# rpm -ivh vsftpd-2.2.2-24.el6.x86_64.rpm Preparing... ########################################### [100%] 1:vsftpd ########################################### [100%]
重启ftp服务:
[root@oracle-linux6 tmp]# service vsftpd restart 关闭 vsftpd: [失败] 为 vsftpd 启动 vsftpd: [确定]
查看21端口状态:
[root@oracle-linux6 tmp]# netstat -an|grep 21 tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN unix 2 [ ] DGRAM 12145 @/org/kernel/udev/udevd unix 3 [ ] DGRAM 12165 unix 3 [ ] DGRAM 12164
root登陆报错“530 Permission denied”:
[root@oracle-linux6 tmp]# ftp 127.0.0.1 Connected to 127.0.0.1 (127.0.0.1). 220 (vsFTPd 2.2.2) Name (127.0.0.1:root): root 530 Permission denied. Login failed. ftp>
问题解决:
注释user_list配置文件的root用户
[root@oracle-linux6 tmp]# view /etc/vsftpd/user_list # vsftpd userlist# If userlist_deny=NO, only allow users in this file # If userlist_deny=YES (default), never allow users in this file, and # do not even prompt for a password. # Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers # for users that are denied. #root bin daemon adm lp sync shutdown halt mail news uucp operator games nobody
再次以root登陆,报错“530 Login incorrect”:
[root@oracle-linux6 tmp]# ftp 127.0.0.1 Connected to 127.0.0.1 (127.0.0.1). 220 (vsFTPd 2.2.2) Name (127.0.0.1:root): root 331 Please specify the password. Password: 530 Login incorrect. Login failed. ftp>
问题解决:
注释配置文件ftpusers的root用户
[root@oracle-linux6 tmp]# view /etc/vsftpd/ftpusers # Users that are not allowed to login via ftp #root bin daemon adm lp sync shutdown halt mail news uucp operator games nobody
重新登陆,成功:
[root@oracle-linux6 tmp]# ftp 127.0.0.1 Connected to 127.0.0.1 (127.0.0.1). 220 (vsFTPd 2.2.2) Name (127.0.0.1:root): root 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> ls 227 Entering Passive Mode (127,0,0,1,118,246). 150 Here comes the directory listing. -rw------- 1 0 0 2172 Aug 02 10:58 anaconda-ks.cfg -rw-r--r-- 1 0 0 28568 Aug 02 10:58 install.log -rw-r--r-- 1 0 0 8442 Aug 02 10:54 install.log.syslog 226 Directory send OK. ftp>