Method 1: Changing the user's home directory
Make sure the following line exists
Set user HOME Directory to /var/www/ , if you want to change for existing user then you can use:
usermod --home /var/www/ username
then set required permission on /var/www/
Method 2: Use user_sub_token
If you don't want to change user's Home ...
Your ftp server needs a channel to transfer data. Port 21 is used to establish the connection. So to make data transfer possible you'd need to enable port 20 as well. See the following configuraton
First load the following module to make sure passive ftp connections are not rejected
Allow FTP connections on port 21 incoming and ...
FTP is an ancient protocol. It relies on two TCP connections: a control connection over which commands are exchanged, and data connections for the content of files and also for the output of commands such as ls. What's happening here is that the control connection is established, but the data connections aren't going through.
By default (active mode), data ...
I saw such extensive rules already in several Blogs etc. and wondered why not simply use
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT
together with the nf_conntrack_ftp module. This is more concise and readable, which is generally a good thing, especially with firewalls...
The command ftp put /path/to/local_file doesn't work with vsftpd. Try the following:
ftp put /path/to/local_file remote_file_name
You may choose any name you wish for the remote_file_name, but you must specify one.
Run this one command, no need to restart any service & server:
# setenforce 0
To check SELinux status :
edit the file /etc/sysconfig/selinux to include
Doing so will require a reboot.
I had same error after PASS command in CENTOS 7. (GnuTLS error -15: An unexpected TLS packet was received.)
My solution is following:
I had to add following to vsftpd.conf:
In addition to Stephane's answer I'd like to point out that there is FTPS, too. FTPS is the classic FTP protocol over an SSL-secured connection. If you meant this you'd have to adjust your question of course, but it would be a completely different question then.
There are two variations of FTPS, one were the control channel is secured (credentials etc) and ...
vsftpd is a FTP server implementing the FTP protocol. Some extensions for encryption are available for FTP, but they are completely different from SFTP which is a subsystem of SSH.
If you want to use sftp, you need to configure a ssh server and enable the sftp subsystem (see the sshd_config man page for details). It's also possible to configure sftp with ...
There is a post here that describes the problem. The new kernel module seccomp is used automatically by vsftpd since version 3.0.0. vsftpd is a bit buggy when using seccomp.
Add this line to the end of /etc/vsftpd.conf
and restart the Server:
sudo service vsftpd restart
Although disabling SELinux by SELINUX=disabled will solve the problem this would not be advisable. You can enable ftp user to access his home directory by configuring SELinux boolean value ftp_home_dir by running the following command:
setsebool -P ftp_home_dir=1
You could try the following in vsftp.conf:-
The man page says:-
If set to YES, anonymous users will be permitted to perform write operations
other than upload and create directory, such as deletion and renaming. This
is generally not recommended but included for completeness.
Working from the vsftpd version 2.2.2, there are two options for keeping users in a chroot jail:
Just add users to the chroot list e.g. (/etc/vsftpd/chroot_list) that you want placing in a chroot jail.
This will place all local users in a chroot jail, however, if this is set then the chroot_list becomes a list of ...
There is (obviously) manual page for vsftpd.conf, which is always a good place to start.
TLDR version: They should be needed only for passive mode of FTP.
Set to NO if you want to disallow the PASV method of obtaining a data connection.
Use this option to override the IP address that vsftpd will advertise in response ...
After you've changed your config to include chroot_local_user=YES
You could change the user's shell to /usr/sbin/nologin so that if the password leaks you will have mitigated some risk (set the home directory too). The shell needs to be listed in /etc/shells as well or authentication will fail.
usermod -d /var/www/my.domain.example -s /usr/sbin/nologin ...
The solution is to limit the ports that vsftpd allocates for PASV style data connections in the configuration file. In the vsftpd.conf, add those two lines:
Then you will need to open those ports in the Google Developers Console, under Networking, Firewall rules (see image).
You also might want to add the following ...
Look at your /etc/passwd file
Find your user and look shell (example ttr:x:501:501::/home/username/ttr:/sbin/nologin)
Add this shell (/bin/false or /sbin/nologin) to your /etc/shell or /etc/shells
After that, check your connection
Try again...If it still does not work
Back up the config file before making a change;
sudo cp /etc/vsftpd.conf /etc/vsftpd....
You can check the installed package version with dpkg -l | grep -i openssl. The actual TLS/SSL version used depends on what the server offers or what is negotiated between server and client in any given session.
Interestingly enough, my vsftpd writes the versino string to stdin. So you probably need to do a rather unusual redirection of stdin to stdout:
i=`/usr/sbin/vsftpd -version 0>&1`
How to find this out: run it in strace (you'll need to do it as root) and check for the string. In my case the log ends like this:
$ strace /usr/sbin/vsftpd -version
I had a similar problem and discovered that it's caused by an environment variable. When you use su, it leaves the UPSTART_SESSION environment variable set (from the original user's environment), which breaks things. Using sudo or su - unsets it, so any of these will work:
$ sudo service vsftpd restart
$ sudo su
# service vsftpd restart
$ su -
# service ...
Here are steps to setup a user and allow the user access only via FTP (i.e. no SSH) and also limit access to a specific (user home) directory on proftpd:
Add new user: adduser newusername
Set password: passwd newusername
Modify user home directory from default to a new folder:
usermod -d /target/directory username
Edit shells file: vi /etc/shells and add /...