LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   vsftpd how do you write files for apache to serve (https://www.linuxquestions.org/questions/linux-newbie-8/vsftpd-how-do-you-write-files-for-apache-to-serve-947404/)

radiosification 05-29-2012 10:43 AM

vsftpd how do you write files for apache to serve
 
Hi everyone,
I just got a raspberry pi and am trying to set it up as a web server. I installed apache and that works fine but I wanted to use vsftpd to allow me to upload web pages from another computer to the apache www directory.
I'm very new to linux and only know the very basic stuff, since I only got the Raspberry Pi a few days ago and have not used linux before that.
It is running debian squeeze.

Does anyone know how I can configure vsftpd to allow me to see and write files to the www directory?

schneidz 05-29-2012 10:52 AM

i would recommend using scp:
Code:

scp index.html pi@host:/var/www/html
the pi user would need write privileges to that directory.

radiosification 05-29-2012 10:58 AM

Thanks for your reply.
Does that code give the user "Pi" permisssion to write only the index.html file or all files in the folder?
I was thinking maybe I should use chmod, would that be suitable and please can you guide me how to set that folder to be read and written by pi.
I have done chmodding before from an ftp client but obviously I can't change the permissions to allow myself to write it over ftp lol.
I know I would probably have to use a line of code into the raspberry pi like the one you specified.

schneidz 05-29-2012 12:04 PM

what distro are you using on the client pc ?
what distro are you using on the server pc (debian squeeze) ?

you basically need to ssh into the server and do a little administration maintenance to allow the users you want to have access to the locations you want probably using sudo(usually chmod , chown , chgrp , ...).

lithos 05-29-2012 12:32 PM

well, the basic thing you need is a username to login through FTP on your server
how-to FTP server
and probably you don't want to allow that user to have a shell access, so you would add a user like:
Code:

#useradd -s /sbin/false -d /path/to/home-directory/username username
YES, "username" twice (2 times),
this will create a local user on your server with "username" and a "home" directory "/path/to/home-directory/username", but without shell login permissions (-s /sbin/false)

Then you edit the "/etc/passwd" file:
Code:

#vim /etc/passwd

and edit the line with "username::path/to/home-directory"  <-- change to /path/to/web/directory (where the web site files are)

then you will need to "chown" that directory and allow others (apache, etc...) to read from it
Code:

#chown username.group /path/to/web/directory  -vR
#chmod 755 /path/to/web/directory

this gives the "username" ownership to "path/to/web/directory" and you basically let others to read/execute it (and the files inside).

Now you have to set the password for "username"
Code:

#password username
...enter the password
...repeat the password

Now if you have vsFTPd configured to allow local users to login you will be able to login and upload/change/delete files.

PS. It's a basic FTP configuration, but I see you are using Debian Squeeze which I don't know and I wrote all this for RHEL/Fedora systems

Anyway, good luck

radiosification 05-29-2012 12:41 PM

I have managed to allow the pi account access by setting the www directory to 777.
I used the code
Quote:

sudo chmod -R 777 /var/www
and now I can access it through this computer over the network using ftp.

radiosification 05-29-2012 01:11 PM

Setting the public to be able to write though, does that mean the public as in anyone, like an anonymous user? Or does it mean all groups?

I don't allow anonymous users on my server for security reasons.

schneidz 05-29-2012 01:49 PM

^ you allowed any user on your system to add/modify/delete files in that directory... i guess you'll be ok until someone guesses your password.

radiosification 05-29-2012 01:52 PM

Haha that should be ok then, I have changed it from the default password.

Thanks for the help.


All times are GMT -5. The time now is 05:41 PM.