Avatar of dimensionav
dimensionav
Flag for Mexico asked on

how to give access to website folders using ftp?

According with this question, now I have an ftp server from a CentOS distro, actually I have created a user but now I wonder how to associate that user with the folder in which should connect to:
https://www.experts-exchange.com/questions/28336243/How-to-set-up-a-static-IP-in-a-CentOS-Server-6-5.html

We pretend to install more than one website in the CentOS vps, and assign one or more ftp user(s) to each website folder.

Regards.
LinuxLinux Security

Avatar of undefined
Last Comment
Sandy

8/22/2022 - Mon
Mazdajai

Assuming you already created local user account, it will most likely in their respective home drive in /etc/passwd once they logged in via ftp. We won't know until you provide more information on the type of ftp software and configuration file.
dimensionav

ASKER
First of all, I have tried to get into FTP, but I couldn't never be connected, I tested the user and password directly on the server and everything is ok.

I have installed LAMP, so the idea is to get access to home folder of each website there.
Sandy

OK...

1. Create a local user having access to that directory
2. Configure VSFTPD with default parameters.
3. either disable SELinux or configure setsebool for ftp_home_dir and ftp_full_access

You users will be able to access web folders via ftp. in case issues you might need to allow few booleans of http... depends on version and distro you are using

Its SELinux which is playing around. :)

TY/SA
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
dimensionav

ASKER
After your post I did what is showed here: http://yohanes.pradono.com/2012/11/18/installing-vsftpd-with-virtual-users-enabled-and-using-pam_pwdfile-for-authentication

But I couldn't have success.

I have disabled SELinux and rebooted the server but I still got the message 530 Login incorrect.

Regards.
Sandy

Are you trying with root ?

If yes,,, you need to remove entry of "root" user in below two files

1. /etc/vsftpd/ftpusers
2. /etc/vsftpd/users_list

If not please paste the screen output

TY/SA
dimensionav

ASKER
I created a new user called vftpuser, just to make all the necessary tests.

You mean this?
vsftperror
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Naranthiran D

Add the "vftpuser" in the file /etc/vsftpd/user_list

And Try connecting...
Sandy

Give me output of below

#sestatus

#setsebool -b | grep ftp

TY/SA
dimensionav

ASKER
NARANTHIRAN:
After adding vftpuser to user_list file I got the error "530 Permission Denied" (Actually the link from I followed the procedure of setting up vsftp says that adding the user will block it).


 Sandeep_Agarwal_ :
#sestatus
SELinux status: disabled

#setsebool -b | grep ftp
setsebool: SELinux is disabled
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER CERTIFIED SOLUTION
Sandy

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
dimensionav

ASKER
Sandy:

Now its working, but the FTP redirects to the user local folder, in this case "/home/test/" folder, is there any way to make the ftp user points to specific virtual host, lets say /var/www/html/mywebsite1 or /var/www/html/mywebsite2 ?

Thanks in advance.
Naranthiran D

Yes you can Point to the specific directory u want...
By editing the following file against the user and add the directory u want to point..

For example:
Username:x:502:503::/var/www/html/mywebsite1:/bin/bash
dimensionav

ASKER
Sorry, could you explain a little bit more how to perform that command and the file edition?
Thanks.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Mazdajai

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Sandy

Correct... Use usermod

TY/SA