Gentoo Forums
Gentoo Forums
Quick Search: in
vsftpd help
View unanswered posts
View posts from last 24 hours

rackathon
Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Mighty3k
n00b
n00b


Joined: 26 Feb 2005
Posts: 49
Location: Sweden

PostPosted: Sat Mar 19, 2005 3:16 pm    Post subject: vsftpd help Reply with quote

Hi!

I think I managed to install vsFTPd and configure it the way I want. But it's not working.
When I start vsFTPd it's not complaining about any errors in the config, it just starts.

But I can't connect from any other computer, not even from on in my local network.

No route to host the error is.. Whats the problem?
_________________
---
Mighty
Back to top
View user's profile Send private message
ikaro
Veteran
Veteran


Joined: 14 Jul 2003
Posts: 2524
Location: Denmark

PostPosted: Sat Mar 19, 2005 8:54 pm    Post subject: Reply with quote

"no route to host" means exactly that.. there is no route to the host.
Either the IP of the server is down or the address impossible.

try to post a bit of your configuration, and how the machines are networked.
_________________
linux: #232767
Back to top
View user's profile Send private message
Mighty3k
n00b
n00b


Joined: 26 Feb 2005
Posts: 49
Location: Sweden

PostPosted: Sun Mar 20, 2005 12:56 pm    Post subject: Reply with quote

I got it to work..

However, how do you specify users and their respective home directory?
_________________
---
Mighty
Back to top
View user's profile Send private message
Mighty3k
n00b
n00b


Joined: 26 Feb 2005
Posts: 49
Location: Sweden

PostPosted: Sun Mar 20, 2005 12:56 pm    Post subject: Reply with quote

I got it to work..

However, how do you specify users and their respective home directory?
_________________
---
Mighty
Back to top
View user's profile Send private message
Corax
Apprentice
Apprentice


Joined: 14 Apr 2004
Posts: 222
Location: Berlin, Germany

PostPosted: Sun Mar 20, 2005 1:02 pm    Post subject: Reply with quote

If you allow only a few users to connect to your server, you could create them directly on your system, collect them in a login group, say ftp_users, and lock all other directories (/bin and /etc have to be executable for them!) for that group using Access Control Lists. If you intend to administer a lot of users on your server, you won't be able to avoid handling with mysql and cyrus-asl and so on. There are a lot of posts that cope with this topic.
_________________
There's no such priest //
that can pray me to heaven.
-- Nightwish, "Bare grace misery"
Back to top
View user's profile Send private message
Corax
Apprentice
Apprentice


Joined: 14 Apr 2004
Posts: 222
Location: Berlin, Germany

PostPosted: Sun Mar 20, 2005 1:10 pm    Post subject: Reply with quote

PS: remember to set
Code:
CHROOT_LOCAL = YES
in your vsftpd.conf
_________________
There's no such priest //
that can pray me to heaven.
-- Nightwish, "Bare grace misery"
Back to top
View user's profile Send private message
Mighty3k
n00b
n00b


Joined: 26 Feb 2005
Posts: 49
Location: Sweden

PostPosted: Sun Mar 20, 2005 1:25 pm    Post subject: Reply with quote

I don't know how do to that :P

This is my first time on linux, I just need to set up an ftp server with 3 users, 1 guest, 1 semi-admin who can upload files and create dir's and 1 user who can do "everything". :D
_________________
---
Mighty
Back to top
View user's profile Send private message
Rad
Guru
Guru


Joined: 11 Feb 2004
Posts: 358
Location: Berne, Switzerland

PostPosted: Sun Mar 20, 2005 2:24 pm    Post subject: Reply with quote

Maybe vsftpd is a bit hard then, unless you find a detailed howto. I suggest you try pure-ftpd (and pureadmin, if you want a GUI), they're ... a bit less intertwined with linux standard stuff like PAM and so on.
Back to top
View user's profile Send private message
Corax
Apprentice
Apprentice


Joined: 14 Apr 2004
Posts: 222
Location: Berlin, Germany

PostPosted: Sun Mar 20, 2005 2:29 pm    Post subject: Reply with quote

To ensure a good start: read the manpage for vsftpd.conf. All settings are explained there. Then, create the users you wish to be able to connect to that server. Assign them to an arbitrary group (either when creating them with useradd or later by usermod). This CHROOT_LOCAL option ensures, that ordinary users aren't allowed to leave their home directories via ftp. Locking all other directories is not mandatory, but is for security reasons, just for the case... (In my case it was necessary, because I had symlinks that pointed to directories outside their directory tree. So I had to take care, that they could enter these certain directories, but not the other, essential ones.) vsftpd also offers options and lists that control, which users can do certain things and not. This server is really versatile. If that is too much, look for other servers, that can be configured more easily - proFTP comes to my mind.
_________________
There's no such priest //
that can pray me to heaven.
-- Nightwish, "Bare grace misery"
Back to top
View user's profile Send private message
ikaro
Veteran
Veteran


Joined: 14 Jul 2003
Posts: 2524
Location: Denmark

PostPosted: Sun Mar 20, 2005 3:57 pm    Post subject: Reply with quote

pure-ftpd is niiiice:)
and there is a nice GTk2 gui : pureadmin.

ps: get the source from the website, because the package in portage its a bit old.
_________________
linux: #232767
Back to top
View user's profile Send private message
destuxor
l33t
l33t


Joined: 29 Feb 2004
Posts: 791

PostPosted: Sun Mar 20, 2005 4:58 pm    Post subject: Reply with quote

I use and love VSFTPD. I don't do passworded FTP (SFTP/SCP rocks), though. About having a privaledged user...what you could do is create those five user accounts like this:
/home/administrator = home for administrative user account (permissions: 700) -- this assumes administrative user account is in a different group.
/home/administrator/semiadmin = home for semi-administrator user account (permissions: 707)
/home/administrator/semiadmin/reguser1 = home for underprivaledged user account (permissions: 557 -- read-only for user, semi-admin can read, admin can read/write)
/home/administrator/semiadmin/reguser2 = home for second underprivaleged user account (permissions: 557)
/home/administrator/semiadmin/reguser3 = home for third underprivaleged user account (permissions: 577 -- this lets semi-admin read/write; you might need that.)

Now lock users into their home directories (CHROOT_LOCAL = YES) and you're golden!

A great tool for adding user accounts is superadduser (emerge superadduser). If you aren't up to speed on the permissions stuff read up on the chmod manpage. You can change ownership, if necessary, with the chown command. Be smart with /etc/vsftpd/ftpusers too, usage of this file depends on what you've got set in the vsftpd.conf.


Hehe I like my way best. Ten minutes to setup tops. Thar's some quality engineering thur :lol:

Edit: The correct syntax is CHROOT_LOCAL_USER = YES, not CHROOT_LOCAL = YES. Original text left unchanged.


Last edited by destuxor on Tue Mar 22, 2005 8:22 pm; edited 1 time in total
Back to top
View user's profile Send private message
Mighty3k
n00b
n00b


Joined: 26 Feb 2005
Posts: 49
Location: Sweden

PostPosted: Sun Mar 20, 2005 5:48 pm    Post subject: Reply with quote

Maybe it'd be easier to get help if you guys knew exactly what I want.

I need a server to upload movies and stuff on (legal home made :P). Me and my friends are doing crazy stuff. And we have a site which we want our visitors to be able to download our work from. The webserver and ftp-server are completly separated. What we need is a server with 1 user who can access all files and download them via the website. And 1 user who can upload files. (Yeah, I know, I changed my mind).

Can someone please describe to me with all commands and things I need to do to get this working? As I said I'm completly new to linux and do not have very much experience. And I can't find any more documentation on vsftpd then the one about the config file and I can't figure out how to do it from just that.

All help is greatly appretiated! Our site has been down for 3 months now and we are eager to get it up!

It don't have to be more complicated than that!

And I can add that I don't have any windowmanager so I guess it will be pretty hard to get that pureftp with a GUI.
_________________
---
Mighty
Back to top
View user's profile Send private message
ikaro
Veteran
Veteran


Joined: 14 Jul 2003
Posts: 2524
Location: Denmark

PostPosted: Sun Mar 20, 2005 6:14 pm    Post subject: Reply with quote

pure-ftpd can also be managed with a terminal.

Code:

~ pure-
pure-authd         pure-ftpwho        pure-pw            pure-quotacheck    pure-statsdecode
pure-ftpd          pure-mrtginfo      pure-pwconvert     pure-sfv           pure-uploadscript


;)
_________________
linux: #232767
Back to top
View user's profile Send private message
destuxor
l33t
l33t


Joined: 29 Feb 2004
Posts: 791

PostPosted: Sun Mar 20, 2005 7:56 pm    Post subject: Reply with quote

See if this works for /etc/vsftpd/vsftpd.conf:
Code:
# /etc/vsftpd/vsftpd.conf - destuxor - 3/20/2005
local_enable=YES
write_enable=YES
anonymous_enable=NO
xferlog_enable=YES
xferlog_file=/var/log/vsftpd/vsftpd.log
idle_session_timeout=600
data_connection_timeout=120
ascii_upload_enable=NO
ascii_download_enable=NO
nopriv_user=ftp
ftpd_banner=Mighty Movies :)
chroot_list_enable=NO
chroot_local_user=YES
background=YES
listen=YES
ls_recurse_enable=NO

And enter these commands:
Code:
mkdir /home/movies
useradd -d /home/movies -s /bin/false -g ftp downloader
useradd -d /home/movies -s /bin/false -g ftp uploader
chown upload:ftp -R /home/movies
chmod 750 -R /home/movies
passwd downloader
passwd uploader
rc-update add vsftpd default

That work? You'll have to give people the login for the downloader account, but I think this is what you want. What I've written is thinking along the same lines as what I wrote earlier. This'll create two user accounts who share a home directory. I don't know if this works or not -- if it doesn't I'd make one home directory a subdirctory of the other. Anyrate, one has rwx access to "his" home directory, the other has only r-x. Should work. Just make sure you do this after a file's been uploaded: chmod -R 750 /home/movies/ (I'm not sure what the permissions VSFTPD sets are).


Last edited by destuxor on Wed Mar 23, 2005 3:19 am; edited 1 time in total
Back to top
View user's profile Send private message
Mighty3k
n00b
n00b


Joined: 26 Feb 2005
Posts: 49
Location: Sweden

PostPosted: Tue Mar 22, 2005 1:03 pm    Post subject: Reply with quote

What did I do wrong if I can't login with the downloader/uploader account? ^^

THANK YOU!! very much btw.

don't know if I did something wrong or if you missed something.
However it feels like some progress are made :)
_________________
---
Mighty
Back to top
View user's profile Send private message
destuxor
l33t
l33t


Joined: 29 Feb 2004
Posts: 791

PostPosted: Tue Mar 22, 2005 2:28 pm    Post subject: Reply with quote

Well, first thing is to make sure that the VSFTPD daemon is started:
Code:
/etc/init.d/vsftpd status
It should say:
Code:
gentoobox john # /etc/init.d/vsftpd status
 * status:  started

If that's good, then let's look into those user accounts. It may be the case that you cannot use /bin/false for a users shell. If that is the case, the most obvious thing is to change it. There's tons of shells...I know you've got Bash installed so let's do that:
Code:
usermod -s /bin/bash downloader
usermod -s /bin/bash uploader

The only problem with this is that these users can now login on your local system. But if you're not using SSH then that isn't a problem. I think you can also deny a user SSH access, but I don't know how.

That work?
Back to top
View user's profile Send private message
Mighty3k
n00b
n00b


Joined: 26 Feb 2005
Posts: 49
Location: Sweden

PostPosted: Tue Mar 22, 2005 3:36 pm    Post subject: Reply with quote

THANK YOU!!
You are seriously my god!! :D

It works!
_________________
---
Mighty
Back to top
View user's profile Send private message
destuxor
l33t
l33t


Joined: 29 Feb 2004
Posts: 791

PostPosted: Tue Mar 22, 2005 5:17 pm    Post subject: Reply with quote

Yayyyayy! Glad I could help! Now to reuse what I wrote in a howto on my website... :)
Back to top
View user's profile Send private message
Mighty3k
n00b
n00b


Joined: 26 Feb 2005
Posts: 49
Location: Sweden

PostPosted: Tue Mar 22, 2005 6:00 pm    Post subject: Reply with quote

Just one more question ;P

The server works just fine locally, but not from outside my network.
Port 20-21 are redirected to the server but I still get "Connection refused" messages..

Are vsftpd using other ports or, yeah.. how do I fix it? ^^
_________________
---
Mighty
Back to top
View user's profile Send private message
destuxor
l33t
l33t


Joined: 29 Feb 2004
Posts: 791

PostPosted: Tue Mar 22, 2005 8:09 pm    Post subject: Reply with quote

In the config file I see these that you could play with. Do you have a firewall for your network blocking port 21?
Code:
# Make sure PORT transfer connections originate from port 20 (ftp-data).
#connect_from_port_20=YES

# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
#local_umask=022


What do you think: http://gentoobox.rh.ncsu.edu/vsftpd-help.html ?

Edit: sorry I never updated the link: http://wjholden.com/vsftpd-help.html


Last edited by destuxor on Sun Apr 08, 2007 2:33 pm; edited 1 time in total
Back to top
View user's profile Send private message
Mighty3k
n00b
n00b


Joined: 26 Feb 2005
Posts: 49
Location: Sweden

PostPosted: Wed Mar 23, 2005 2:55 am    Post subject: Reply with quote

As I said port 20-21 are redirected to my server.
And I added the connect_from_port_20=YES to my config.
It doesn't make any difference. :(
_________________
---
Mighty
Back to top
View user's profile Send private message
destuxor
l33t
l33t


Joined: 29 Feb 2004
Posts: 791

PostPosted: Wed Mar 23, 2005 3:17 am    Post subject: Reply with quote

I think I made a mistake with this.
destuxor wrote:
echo uploader >> /etc/vsftpd/ftpusers
echo downloader >> /etc/vsftpd/ftpusers
Open /etc/vsftpd/ftpusers and remove downloader and uploader from this. I apologize :oops: I got mixed up somehow. /etc/vsftpd/ftpusers is a file that specifies users that cannot get FTP access.

For security, you may want to add your "real" user account to this list, that way someone couldn't possibly hijack the machine that way. Having a wheel (or *shudder* sudo) user with FTP access isn't a great idea in terms of security.
Back to top
View user's profile Send private message
Mighty3k
n00b
n00b


Joined: 26 Feb 2005
Posts: 49
Location: Sweden

PostPosted: Wed Mar 23, 2005 1:02 pm    Post subject: Reply with quote

Haha, it was my friends computer that was screwed up :P
I managed to connect today, but it seems like the user uploader has no permissions at all, can't list directories, download, upload.. anything.. :S
How do I change the permissions?

Btw, I haven't checked what downloader can do..
_________________
---
Mighty
Back to top
View user's profile Send private message
destuxor
l33t
l33t


Joined: 29 Feb 2004
Posts: 791

PostPosted: Wed Mar 23, 2005 2:34 pm    Post subject: Reply with quote

Does adding this to the config fix it?
Code:
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
You'll have to restart the daemon after this with the command /etc/init.d/vsftpd restart

I think you still need to remove downloader and uploader from /etc/vsftpd/ftpusers
Back to top
View user's profile Send private message
Mighty3k
n00b
n00b


Joined: 26 Feb 2005
Posts: 49
Location: Sweden

PostPosted: Wed Mar 23, 2005 4:58 pm    Post subject: Reply with quote

actually, when I looked in ftpusers, they were not there^^
I musted av missed the part where I was supposed to get it there ;D

but even after adding that to the file it didn't work.. dirmessage stuff..
_________________
---
Mighty
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum