I'm struggling in creating an FTP user on a Linux server using the command line.
- I installed
vsftpd
- Then i created a user using multiple commands for multiple times like
sudo adduser --home /home/testuser testuser --no-create-home
- Added password to it,
- Edited
etc/vsftpd.conf
file, - enabled
chroot_local_user=YES
, - Added user name to config files, etc etc. But none seems to work.
- They are getting created as SFTP users. I disabled the SSH access and then it stopped for FTP too.
- What all I need is to do is simply set up an FTP user and jail them to a path without SSH access. Can anyone help? I had gone through a lot of posts. But still no solution.
CodePudding user response:
There are lot more FTP serves like vsftpd, ProFTP, and PureFTP. But with vsftpd there are known issues. That's right. You can use ProFTP and I followed the same method using ProFTP. It worked.
CodePudding user response:
Instead of trying vsftpd
,
I used ProFTP
and it worked. I followed the below steps and it worked.
ProFTP Setup in Linux:
- Document Link https://www.digitalocean.com/community/tutorials/how-to-set-up-proftpd-on-ubuntu-12-04
sudo apt-get install proftpd (to install)
sudo apt-get remove proftpd (to uninstall)
- Edit the ProFTP configuration file located at
/etc/proftpd/proftpd.conf
to update specific settings
sudo vi /etc/proftpd/proftpd.conf
- Make sure the ServerName and MasqueradeAddress are set to the current machine’s Public or Elastic IP Address.
- Set RequireValidShell to false. Set DefaultRoot to ~ to jail users to their home directories only.
ServerName "54.187.75.250"
ServerType standalone
MasqueradeAddress 54.187.75.250
RequireValidShell off
DefaultRoot ~
PassivePorts 50000 51000
<IfModule mod_facts.c>
FactsAdvertise off
</IfModule>
Creating an ftp user
- Add a ftp user to the system
sudo useradd -m ftpuser (the -m option is to create a home directory for the user)
- Set user’s password
sudo passwd ftpuser
- At a later time, you may delete the user by executing
sudo deluser ftpuser
Test if FTP server is up and running from a remote machine, login using the id/pwd of the newly created
ftpuser
Transfer files back and forth.Restart FTP server
sudo service proftpd restart
sudo /etc/init.d/proftpd start