LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   vsFTPd 530 Permission denied external login (https://www.linuxquestions.org/questions/linux-server-73/vsftpd-530-permission-denied-external-login-908032/)

cso 10-13-2011 04:16 PM

vsFTPd 530 Permission denied external login
 
Hi folks,

I have installed and configured vsFTPd on my fedora 14 server. When I connect to in through my local network everything works just fine. The problems occurs when I connect through the internet.

When I use an computer that is outside my local network, for example a friends computer, I get the following:

Quote:

Status: Connecting to 80.61.xx.xxx:21...
Status: Connection established, waiting for welcome message...
Response: 220 Inactivity timer = 120 seconds. Use 'site idle <secs>' to change.
Command: USER xxxxxxxxx
Response: 331 Password required.
Command: PASS **********
Response: 530 Permission denied
Error: Critical error
Error: Could not connect to server
I set up NAT port forwarding in my router for ports 21 and 20. They are forwarded to the correct server.

Is there anyone who can help me?

T3RM1NVT0R 10-13-2011 04:24 PM

@ Reply
 
It appears to me that as soon as you login it is trying to change the directory to default but it is unable to do so.

Paste your vsftpd.conf file and selinux status.

To get selinux status and booleans for ftp type the following commands:

Code:

setstatus
Code:

getsebool -a | grep ftp

cso 10-13-2011 04:38 PM

Below the requested information:

Response by getsebool -a | grep ftp:
Code:

allow_ftpd_anon_write --> off
allow_ftpd_full_access --> off
allow_ftpd_use_cifs --> off
allow_ftpd_use_nfs --> off
ftp_home_dir --> on
ftpd_connect_db --> off
httpd_enable_ftp_server --> off
sftpd_anon_write --> off
sftpd_enable_homedirs --> off
sftpd_full_access --> off
sftpd_write_ssh_home --> off
tftp_anon_write --> off

response from sestatus:
Code:

SELinux status:                enabled
SELinuxfs mount:                /selinux
Current mode:                  permissive
Mode from config file:          enforcing
Policy version:                24
Policy from config file:        targeted

The vsftpd.conf file:
Code:

# Config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
ascii_upload_enable=YES
ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd/banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
chroot_local_user=YES
chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd/chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd with two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES

pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
use_localtime=YES


T3RM1NVT0R 10-13-2011 04:46 PM

@ Reply
 
Is there anything in your iptables that is denying any external users to connect?

Try to access the ftp server externally and once it fails paste the output of the following command:

Code:

tail /var/log/messages

cso 10-13-2011 05:00 PM

tail /var/logs/messages gives me the following:

Code:

Oct 13 23:46:29 server setroubleshoot: SELinux is preventing the http daemon from reading users' home directories. For complete SELinux messages. run sealert -l 96babc23-afb4-4773-b1ac-5a5482cf4bb9
Oct 13 23:46:34 server vsftpd[2119]: warning: /etc/hosts.allow, line 11: missing ":" separator
Oct 13 23:46:41 server vsftpd[2125]: warning: /etc/hosts.allow, line 11: missing ":" separator
Oct 13 23:46:54 server vsftpd[2131]: warning: /etc/hosts.allow, line 11: missing ":" separator
Oct 13 23:48:08 server vsftpd[2139]: warning: /etc/hosts.allow, line 11: missing ":" separator
Oct 13 23:48:24 server vsftpd[2146]: warning: /etc/hosts.allow, line 11: missing ":" separator
Oct 13 23:48:36 server vsftpd[2152]: warning: /etc/hosts.allow, line 11: missing ":" separator
Oct 13 23:48:43 server vsftpd[2158]: warning: /etc/hosts.allow, line 11: missing ":" separator
Oct 13 23:49:22 server setroubleshoot: SELinux is preventing the http daemon from reading users' home directories. For complete SELinux messages. run sealert -l 96babc23-afb4-4773-b1ac-5a5482cf4bb9
Oct 13 23:53:27 server setroubleshoot: SELinux is preventing the http daemon from reading users' home directories. For complete SELinux messages. run sealert -l f912aca9-9f78-41bc-ae7d-9e80a44ef2a1

I repaired the third warning: Oct 13 23:46:34 server vsftpd[2119]: warning: /etc/hosts.allow, line 11: missing ":" separator
I still have the same problem.
Where can I view the iptables?

T3RM1NVT0R 10-13-2011 05:04 PM

@ Reply
 
Try this, turn on the following boolean: httpd_enable_ftp_server

Following command will enable it:

Code:

setsebool -P httpd_enable_ftp_server=on
Remember the above command will take little time to complete so be patient.

Restart vsftpd service and then give it a try.

You can check the iptables using the following command:

Code:

service iptables status
and

Code:

cat /etc/iptables
Not sure of the second one. Don't have CentOS or RHEL or Fedora system handy.

cso 10-13-2011 05:14 PM

I dit the command you said and below is the result. There is no chance.
Code:

[root@server /]# getsebool -a | grep httpd
allow_httpd_anon_write --> off
allow_httpd_mod_auth_ntlm_winbind --> off
allow_httpd_mod_auth_pam --> off
allow_httpd_sys_script_anon_write --> off
httpd_builtin_scripting --> on
httpd_can_check_spam --> off
httpd_can_network_connect --> off
httpd_can_network_connect_cobbler --> off
httpd_can_network_connect_db --> off
httpd_can_network_memcache --> off
httpd_can_network_relay --> off
httpd_can_sendmail --> off
httpd_dbus_avahi --> on
httpd_enable_cgi --> on
httpd_enable_ftp_server --> off
httpd_enable_homedirs --> on
httpd_execmem --> off
httpd_read_user_content --> on
httpd_setrlimit --> off
httpd_ssi_exec --> off
httpd_tmp_exec --> off
httpd_tty_comm --> on
httpd_unified --> off
httpd_use_cifs --> off
httpd_use_gpg --> off
httpd_use_nfs --> off

Code:

[root@server /]# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num  target    prot opt source              destination
1    ACCEPT    all  --  0.0.0.0/0            0.0.0.0/0          state RELATED,ESTABLISHED
2    ACCEPT    icmp --  0.0.0.0/0            0.0.0.0/0
3    ACCEPT    all  --  0.0.0.0/0            0.0.0.0/0
4    ACCEPT    tcp  --  0.0.0.0/0            0.0.0.0/0          state NEW tcp dpt:22
5    ACCEPT    tcp  --  0.0.0.0/0            0.0.0.0/0          state NEW tcp dpt:80
6    ACCEPT    tcp  --  0.0.0.0/0            0.0.0.0/0          state NEW tcp dpt:21
7    ACCEPT    tcp  --  0.0.0.0/0            0.0.0.0/0          state NEW tcp dpt:443
8    ACCEPT    udp  --  0.0.0.0/0            0.0.0.0/0          state NEW udp dpt:137
9    ACCEPT    udp  --  0.0.0.0/0            0.0.0.0/0          state NEW udp dpt:138
10  ACCEPT    udp  --  0.0.0.0/0            0.0.0.0/0          state NEW udp dpt:137
11  ACCEPT    udp  --  0.0.0.0/0            0.0.0.0/0          state NEW udp dpt:138
12  ACCEPT    tcp  --  0.0.0.0/0            0.0.0.0/0          state NEW tcp dpt:139
13  ACCEPT    tcp  --  0.0.0.0/0            0.0.0.0/0          state NEW tcp dpt:445
14  REJECT    all  --  0.0.0.0/0            0.0.0.0/0          reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
num  target    prot opt source              destination
1    REJECT    all  --  0.0.0.0/0            0.0.0.0/0          reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
num  target    prot opt source              destination


T3RM1NVT0R 10-13-2011 05:21 PM

@ Reply
 
Sorry the syntax will be

Code:

setsebool -P httpd_enable_ftp_server on
and if you could turn off firewall for a while just to make sure it is not a firewall issue. You can type the following commands:

To stop iptables:

Code:

service iptables stop
To start:

Code:

service iptables start
From what you have posted in the first post it appears to be a firewall issue to me as ftp is working fine internally. So, there should be something that is blocking the external traffic.

cso 10-13-2011 07:05 PM

Okay. I disabled iptables and restarted the ftp server. This did not solve the problem.

T3RM1NVT0R 10-14-2011 01:42 AM

@ Reply
 
Alright. The best way that I can think now to track down the issue is to take a tcp dump. If you are trying to FTP this machine externally via Windows you can use Wireshark tool. If you are trying to FTP this machine externally via linux then you can use tcpdump.

oppiet30 12-13-2011 09:25 PM

Try putting /bin/bash in /etc/shells file. It states in the /etc/shells file that ftp daemons require a listing of shells to be in this file.

dthaler 12-16-2011 03:42 PM

if you're trying to connect as root try this, /etc/vsftpd/ftpusers and ect/vsftpd/users_list and comment out root... this worked for me

T3RM1NVT0R 12-16-2011 04:00 PM

@ Reply
 
Hi dthaler and oppiet30,

OP didn't respond after 14th Ocotober' 2011. I would say it is pointless to post a reply on a thread which has been inactive for last 2 months. Posting in a dead thread is useless as it generates an unnecessary email notification to all people who are subscribed to this thread.


All times are GMT -5. The time now is 10:25 AM.