LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-29-2012, 10:43 AM   #1
radiosification
LQ Newbie
 
Registered: May 2012
Posts: 5

Rep: Reputation: Disabled
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?
 
Old 05-29-2012, 10:52 AM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
i would recommend using scp:
Code:
scp index.html pi@host:/var/www/html
the pi user would need write privileges to that directory.
 
Old 05-29-2012, 10:58 AM   #3
radiosification
LQ Newbie
 
Registered: May 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
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.
 
Old 05-29-2012, 12:04 PM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
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 , ...).

Last edited by schneidz; 05-29-2012 at 12:08 PM.
 
Old 05-29-2012, 12:32 PM   #5
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
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
 
Old 05-29-2012, 12:41 PM   #6
radiosification
LQ Newbie
 
Registered: May 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
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.
 
Old 05-29-2012, 01:11 PM   #7
radiosification
LQ Newbie
 
Registered: May 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
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.
 
Old 05-29-2012, 01:49 PM   #8
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
^ 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.
 
Old 05-29-2012, 01:52 PM   #9
radiosification
LQ Newbie
 
Registered: May 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Haha that should be ok then, I have changed it from the default password.

Thanks for the help.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache Virtual Host doesnt serve files from correct directories ajb1967 Linux - Server 3 08-05-2010 04:55 AM
Apache can't write files despite permissions/ownership linuxChique Linux - Software 2 02-20-2006 10:08 AM
Setting file permissions so Apache can serve my files thomasfingram Linux - Security 6 12-06-2005 05:54 PM
vsftpd: allow users to write and delete files me3 Linux - Software 4 03-04-2005 07:22 PM
Apache Server won't serve up large files perrond Linux - Networking 4 06-21-2004 10:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration