LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   ftp server .... again (https://www.linuxquestions.org/questions/linux-software-2/ftp-server-again-47756/)

nautilus_1987 03-01-2003 12:27 PM

ftp server .... again
 
:Pengy:
I have a super-numb question: How can I quickly configure ProFTPd server so that my friends could connect to my box as anonymous to upload and download some files :]

a big thnx in advance

Crashed_Again 03-01-2003 12:30 PM

Here is a tutorial.

MasterC 03-01-2003 12:38 PM

Also, you can copy my proftpd.conf file and use it. Mod a few things out of it if I were you though (like the Passive). Here it is:
ftp://masterc.no-ip.org/share/proftpd.conf OR
http://masterc.no-ip.org/share/proftpd.conf

Cool

nautilus_1987 03-01-2003 12:40 PM

thnx of course, but I had similar config.
The thing I need is, some tips, fo e.g:
1. create ftp user
2. create /home/ftp/uploads
3. use inetd

I mean I want to hear the guy who have made proftp working :)
For e.g if someone asked me how to config Apache, it would be no problem for me to help ......... :)

nautilus_1987 03-01-2003 12:40 PM

someone knows howto restart proftpd?

MasterC 03-01-2003 12:43 PM

As for upload....

You don't wanna allow anonymous upload (normally). I'd require them to login to upload. If you want to make a generic user for all of them to use (assuming you trust them enough) then just create a regular user on your system ( I prefer to use adduser via command line). Then they can login with that person. If you want the directory they automatically appear in to be the same as the anonymous one, change that users home directory to be the same as the anonymous one (Mine is /home/ftp). Also, create the user ftp and group ftp

Quick and easy and I think that about covers it all. Create the group first, then when adding new users (and the ftp user) you can put them directly into the ftp group instead of the default "users" group.

When modifying their home directory (in /etc/passwd) you should probably modify their shell too. If you do wanna allow them to ssh into your box, use rbash, if you don't want them to ssh in at all, use /bin/false

Cool

Crashed_Again 03-01-2003 12:44 PM

/etc/init.d/proftpd restart

If your friend is going to connect anonymously then why would you need to create and ftp user?

MasterC 03-01-2003 12:46 PM

http://proftpd.linux.co.uk/localsite...28.html#AEN330

If you stopped it, just type:
proftpd (as root) and it will start.

Cool

nautilus_1987 03-01-2003 12:47 PM

:) lots of useful info........
So what I have done:
1. I have user nobody and ftp, and group nogroup and ftp
2. I use proftpd basic conf
.....................................
MasterC maybe you know how can I restart the server with some command and where to place welcome.msg ....... ?

nautilus_1987 03-01-2003 12:49 PM

sorry I was a bit late :)

MasterC 03-01-2003 12:51 PM

Quote:

Originally posted by nautilus_1987
thnx of course, but I had similar config.
The thing I need is, some tips, fo e.g:
1. create ftp user
2. create /home/ftp/uploads
3. use inetd

I mean I want to hear the guy who have made proftp working :)
For e.g if someone asked me how to config Apache, it would be no problem for me to help ......... :)

Create the user with root by typing:
adduser

First off though, open up /etc/group and add a group:
ftp
With an entry like so:
ftp::50:

Then fire up adduser and when you get to the point of initial group, add them to the ftp group.

I own everything to this user/group so when you create the home directory and:
mkdir /home/ftp/uploads make sure you own them to that user:
chown -R /home/ftp

As for inetd, really I don't mess with it alot. I looked through it a bit, but there wasn't much I needed to dork with.

Cool

nautilus_1987 03-01-2003 12:52 PM

using anonymous config
===========
NcFTP 3.1.3 (Mar 27, 2002) by Mike Gleason (ncftp@ncftp.com).
Sorry, no server available to handle request on cl176-220.ktv.lt. Server hungup immediately after connect.
=================
using basic.conf
=====
500 Sorry, no server available to handle request on cl176-220.ktv.lt.
ftp>
=====
well it seems I will have alittle bit of work to do

nautilus_1987 03-01-2003 12:53 PM

thnx guys, but still any help is appreciated

MasterC 03-01-2003 12:53 PM

I don't ever restart my server. However, you could easily kill it. As root:
killall proftpd OR
ps -aux (locate the pid)
kill -15 pid (I don't know if 15 is a good signal, but that's what I use ;) )

Then just start it again:
proftpd

As for your welcome.msg... I have mine in the /home/ftp directory, as a .message file (notice the . ;) )

Cool

MasterC 03-01-2003 12:55 PM

Quote:

Originally posted by nautilus_1987
using anonymous config
===========
NcFTP 3.1.3 (Mar 27, 2002) by Mike Gleason (ncftp@ncftp.com).
Sorry, no server available to handle request on cl176-220.ktv.lt. Server hungup immediately after connect.
=================
using basic.conf
=====
500 Sorry, no server available to handle request on cl176-220.ktv.lt.
ftp>
=====
well it seems I will have alittle bit of work to do

Make sure it's running:
ps -aux

If it is, then check your /var/log/proftpd.log file for answers on how to fix the errors.

Cool

MasterC 03-01-2003 01:04 PM

If you want, you can post up your /var/log/proftpd.log file so we can see what's going on and try to help...

Cool

nautilus_1987 03-02-2003 04:07 AM

well I think to long but never mind :] :
Dec 30 22:38:58 localhost proftpd[1620] localhost: ProFTPD 1.2.5 (built Sun Jun 9 17:24:50 PDT 2002) standalone mode STARTUP
Dec 30 22:39:12 localhost proftpd[1623] localhost (cl176-220.ktv.lt[213.226.176.220]): FTP session opened.
Dec 30 22:39:12 localhost proftpd[1623] localhost (cl176-220.ktv.lt[213.226.176.220]): no such user 'ftp'
Dec 30 22:39:12 localhost proftpd[1623] localhost (cl176-220.ktv.lt[213.226.176.220]): USER ftp: no such user found from cl176-220.ktv.lt [213.226.176.220] to 213.226.176.220:21
Dec 30 22:39:12 localhost proftpd[1623] localhost (cl176-220.ktv.lt[213.226.176.220]): FTP session closed.
Dec 30 22:44:41 localhost proftpd[134] localhost: Failed binding to 0.0.0.0, port 21: Address already in use
Dec 30 22:44:41 localhost proftpd[134] localhost: Check the ServerType directive to ensure you are configured correctly.
Dec 30 22:53:15 localhost proftpd[138] localhost: Failed binding to 0.0.0.0, port 21: Address already in use
Dec 30 22:53:15 localhost proftpd[138] localhost: Check the ServerType directive to ensure you are configured correctly.
Dec 30 22:53:23 localhost proftpd[140] localhost: Failed binding to 0.0.0.0, port 21: Address already in use
Dec 30 22:53:23 localhost proftpd[140] localhost: Check the ServerType directive to ensure you are configured correctly.
Dec 30 22:53:27 localhost proftpd[143] localhost: Failed binding to 0.0.0.0, port 21: Address already in use

That is the most important cause everything else is repeating...

MasterC 03-02-2003 04:18 AM

So after you created user ftp what happened?

nautilus_1987 03-02-2003 04:19 AM

Dudes here is my config... Who understands correct it plz
==============
ServerName "My personal server"
ServerType standalone

# Port 21 is the standard FTP port.
Port 21

# Set the user and group that the server normally runs at.
User nobody
Group nogroup

MaxInstances 5

# Set the maximum number of seconds a data connection is allowed
# to "stall" before being aborted.
TimeoutStalled 300

DisplayLogin welcome.msg
DisplayFirstChdir .message

# Our "basic" anonymous configuration, including a single
# upload directory ("uploads")
<Anonymous ~ftp>

# Allow logins if they are disabled above.
<Limit LOGIN>
AllowAll
</Limit>

# Maximum clients with message
MaxClients 5 "Sorry, max %m users are allowed -- try again later"

User ftp
Group ftp
# We want clients to be able to login with "anonymous" as well as "ftp"
UserAlias anonymous ftp

# Limit WRITE everywhere in the anonymous chroot
<Limit WRITE>
DenyAll
</Limit>

# An upload directory that allows storing files but not retrieving
# or creating directories.
<Directory uploads/*>
<Limit READ>
DenyAll
</Limit>

<Limit STOR>
AllowAll
</Limit>
</Directory>

# Hide all files owned by user 'root'
HideUser root

</Anonymous>
#EOF
==============
But when I start proftpd, I get:
500 Sorry, no server available to handle request on cl176-220.ktv.lt.
ftp>

???:confused:

nautilus_1987 03-02-2003 04:20 AM

U see I had it before:
ftp:*:1001:0::/home/ftp:

MasterC 03-02-2003 04:35 AM

Check your /etc/ftpusers file, make sure you have included a # in front of a user ftp if one exists. In other words, comment out the ftp user if there is one in there.

MasterC 03-02-2003 04:35 AM

Are you on Slack or what?

nautilus_1987 03-02-2003 04:46 AM

damn, I've go it work, but then I have read CrashedAgain tips and server doesn't works again...uhhh
Chad, I am on Slack offcourse.
When I will fix the problem I will inform U Chad and if you want you can connect to my box :)

MasterC 03-02-2003 04:52 AM

:) Thanks. I don't see anything immediately wrong with your conf file, and if you have the user added, and owning the directory that you want your users to connect to... I don't see a defaultRoot.

Try making a default root, and then owning that directory to user/group ftp like so:
DefaultRoot ~
(Place that just under the standalone entry)
And then, look at your user "ftp" and see where the home directory lives for him. Then:
chown -R ftp:ftp /path/to/ftp/home (probably /home/ftp since that's default)

Cool

nautilus_1987 03-02-2003 04:55 AM

Ok here is what I have got...:
when I do ftp localhost I get:
[root@ ~/tmp/proftpd-1.2.7]# ftp localhost
Connected to localhost.
220 ProFTPD 1.2.7 Server (My personal server) [localhost]
Name (localhost:root): ftp
331 Anonymous login ok, send your complete email address as your password.
Password:
230-Hello, you are on My personal FTP server! Enjoy!
230 Anonymous access granted, restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful
150 Opening ASCII mode data connection for file list
226 Transfer complete.
ftp>

When I do ftp "My IP":
[root@ ~/tmp/proftpd-1.2.7]# ftp 213.226.176.220
Connected to 213.226.176.220.
500 Sorry, no server available to handle request on cl176-220.ktv.lt.
ftp>

:confused:

nautilus_1987 03-02-2003 05:00 AM

sorry such big amount of stupid questions :) I am in a hurry

MasterC 03-02-2003 05:02 AM

Hmmm... I just got the same thing.

Very odd indeed. Just for fun, try switching server type to inetd:
#ServerType standalone
ServerType inetd

And adding (or modifying actually) this line to /etc/inetd.conf:
# File Transfer Protocol (FTP) server:
ftp stream tcp nowait root /usr/sbin/tcpd proftpd

If it doesn't already exist as such.

Then, follow the directions at the top of /etc/inetd.conf and type:
Code:

# If you make changes to this file, either reboot your machine or send the
# inetd a HUP signal:
# Do a "ps x" as root and look up the pid of inetd. Then do a
# "kill -HUP <pid of inetd>".
# The inetd will re-read this file whenever it gets that signal.
#

Cool

MasterC 03-02-2003 05:04 AM

Quote:

Originally posted by nautilus_1987
Ok here is what I have got...:
when I do ftp localhost I get:
[root@ ~/tmp/proftpd-1.2.7]# ftp localhost
Connected to localhost.
220 ProFTPD 1.2.7 Server (My personal server) [localhost]
Name (localhost:root): ftp
331 Anonymous login ok, send your complete email address as your password.
Password:
230-Hello, you are on My personal FTP server! Enjoy!
230 Anonymous access granted, restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful
150 Opening ASCII mode data connection for file list
226 Transfer complete.
ftp>

When I do ftp "My IP":
[root@ ~/tmp/proftpd-1.2.7]# ftp 213.226.176.220
Connected to 213.226.176.220.
500 Sorry, no server available to handle request on cl176-220.ktv.lt.
ftp>

:confused:

This one just keeps screaming at me "port forwarding" however if you are using your actual IP I'm guessing you don't have a need to use port forwarding. But, look into any IPTables you've got setup. If you are using firewalker for your firewall script, make sure you aren't blocking port 21 traffic (from anywhere, not just iptables).

Cool

nautilus_1987 03-02-2003 05:07 AM

all firewalls are shut down...
Oh I have a question how can I enable logging in ProFTPd?
(U see I have put my config in /etc/proftpd.conf so I shrinked the default config)

nautilus_1987 03-02-2003 05:10 AM

by the way do I have to make:
ftp stream tcp nowait root /usr/sbin/tcpd proftpd OR
ftp stream tcp nowait root /usr/sbin/proftpd proftpd

MasterC 03-02-2003 05:12 AM

Logging is with the entries:
SystemLog /var/log/proftpd.log
TransferLog /var/log/xferlog

Change the paths/files to suite your needs.

I'm still leaning wayyy towards a port issue. Change the port, then ftp with:
ftp 1.2.3.4:8000 (assuming you change to port 8000)

Cool

MasterC 03-02-2003 05:14 AM

I use tcpd but that's just because I don't understand the inetd thing all that well and it works so I don't change it ;)

Cool

nautilus_1987 03-02-2003 05:20 AM

aha, how can I change port

MasterC 03-02-2003 05:27 AM

In your config file:
# Port 21 is the standard FTP port.
Port 21

Edit it:
# Port 21 is the standard FTP port.
Port 8000

Then kill/start it (or if you are using inetd HUP it)

Cool

nautilus_1987 03-02-2003 05:34 AM

Inetersting, where fron ProFTPd reads configuration:
fron /etc or /usr/local ?

MasterC 03-02-2003 05:38 AM

Depends on how you've installed it. I think if you go from source it's usr/local if you use slack's default it's /etc

I just tried connecting again, and got a better, but still failed response.... I was reading the RFC on the error (421) and it doesn't make any sense. I'd switch back to port 21 and we'll troubleshoot that out a different way.

Cool

nautilus_1987 03-02-2003 05:42 AM

some one can explain me the thing that when I do
ftp localhost - everything is fine
but when I do
ftp 213.226.176.220 - it sux?

Chad could you please post your config?

MasterC 03-02-2003 05:44 AM

Sure:
Code:

# This is a basic ProFTPD configuration file.
# It establishes a single server and a single anonymous login.
# It assumes that you have a user/group "nobody" and "ftp"
# for normal/anonymous operation.

ServerName                      "ProFTPD MasterC Style"
#ServerType                    standalone
ServerType                      inetd
DefaultServer                  on
DefaultRoot                    ~

# Port 21 is the standard FTP port.
Port                            21
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask                          022

#Passive FTP
PassivePorts                  60000 65535

# To prevent DoS attacks, set the maximum number of child processes
# to 30.  If you need to allow more than 30 concurrent connections
# at once, simply increase this value.  Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd)
MaxInstances                    30

# Set the user and group that the server normally runs at.
User                            nobody
Group                          nogroup

# This next option is required for NIS or NIS+ to work properly:
#PersistentPasswd off

SystemLog                      /var/log/proftpd.log
TransferLog                    /var/log/xferlog

# Normally, we want files to be overwriteable.
<Directory /*>
  AllowOverwrite                on
</Directory>

# A basic anonymous FTP server configuration.
# To enable this, remove the user ftp from /etc/ftpusers.
<Anonymous /home/ftp>
  RequireValidShell            off
  User                          ftp
  Group                        ftp
  # We want clients to be able to login with "anonymous" as well as "ftp"
  UserAlias                    anonymous ftp

  # Limit the maximum number of anonymous logins
  MaxClients                    100

  # We want 'welcome.msg' displayed at login, and '.message' displayed
  # in each newly chdired directory.
  DisplayLogin                  .message
  DisplayFirstChdir            .message

  # Limit WRITE everywhere in the anonymous chroot
  <Limit WRITE>
    DenyAll
  </Limit>

  # An upload directory that allows storing files but not retrieving
  # or creating directories.
#  <Directory incoming/*>
#    <Limit READ>
#      DenyAll
#    </Limit>
#
#    <Limit STOR>
#      AllowAll
#    </Limit>
#  </Directory>

</Anonymous>

Cool

MasterC 03-02-2003 05:46 AM

Quote:

Originally posted by nautilus_1987
some one can explain me the thing that when I do
ftp localhost - everything is fine
but when I do
ftp 213.226.176.220 - it sux?

Chad could you please post your config?

That's why I'm thinking it's a port thing. From inside your localhost (no port to enter from outside) it works. That means your server is running. Then, when you try from outside, using your IP (even though that is localhost, it's going out and back in) it's failing. Why? Because it can't get to your 'puter, why, well I'm guessing from a port being blocked. How? Hell if I know :D

Cool

nautilus_1987 03-02-2003 05:50 AM

(your logical explanations are great )
SO you server with your config works fine?

MasterC 03-02-2003 05:59 AM

Hmm, put it that way, and no it doesn't. :D Yes, it does work fine as far as proftpd is concerned, but no it doesn't work fine because I am having problems with PassiveFTP and my router. However, remove my router from the equation, and yes, my ftp works flawlessly. :)

Cool

MasterC 03-02-2003 06:22 AM

Well man, I am takin off too bed, it's just past 4AM here, and I'm about to drop dead. A few last minute advice(s):
Look at which conf file it's using. Modify that one. Make sure your port is open (run a port scan) and then make sure the server is running:
ps -aux

Good Luck

Cool

nautilus_1987 03-02-2003 06:22 AM

interresting, what will happen if I will make an FTP user with uid=50?
And is there some difference if I will use instead of:
User nobody
Group nogroup
:
User ftp
Group ftp

nautilus_1987 03-02-2003 06:26 AM

hehe sorry I forgot that we in deferent time zone :) hehe sorry
It's 14:22 :cool:

THNX alot Chad

MasterC 03-02-2003 04:15 PM

No, you want to start them as user/group nobody because those people don't actually exist on your system.

And I don't think it'd matter what uid your ftp user has. Instead, what is your home directory in /etc/passwd for your user 'ftp'?

Cool

jm1389 07-26-2003 11:35 PM

I had the same probelm Here is what I did to solve it:

added: DefaultServer on

to my proftpd.conf and commented out

ServerIdent on


have fun


All times are GMT -5. The time now is 12:01 PM.