LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   changing the port on vsftpd (https://www.linuxquestions.org/questions/linux-software-2/changing-the-port-on-vsftpd-58256/)

nuzzy 05-05-2003 03:18 PM

changing the port on vsftpd
 
How would I change the standard port 21 on vsftpd to one I select, i.e., port 5544?

david_ross 05-05-2003 03:26 PM

Add:
listen_port 5544

to vsftpd.conf and that should do it.

You can get all the config options using:
man vsftpd.conf

nuzzy 05-05-2003 04:45 PM

Hi David,

I tried that yesterday and it didn't work. I entered the port into /etc/services as well and in my FW, but it still only works on port 21 and not the other.

david_ross 05-05-2003 05:51 PM

mmm - I've just ran some tests and it didn't work (to start with). When issuing a restart command to the service - the first time it stopped and started. From then on (I tried several times) it failed to stop but said it started.

I tried it on several ports including 110 (I don't have a pop server installed) and all failed.

I then rebooted into mandrake (same machine) to check something completely unrelated.

When I rebooted to RH9 I again changed the config file and issued a service restart command. This time it worked perfectly.

I have no idea why it failed the first time. It will now work on 5544, 110, 66 etc no problem.


All I can say is:
Try rebooting and change the config as the first thing you do. I'm not sure what could be causing this. If anyone has any idea I'd love to know - I'll do some digging myself if I have time.

nuzzy 05-05-2003 06:52 PM

no go for me :( I'm using RH9 and cloned the ftp setting in iptables with the port I wanted to use and added to /etc/services:

vsftpd 41202/tcp

still no luck...also rebooted to and tried both listen_port=41202 and listen_port 41202 (no = sign).

nuzzy 05-05-2003 07:03 PM

OK...got it working...I didn't have it in standalone mode and had to add the line "listen=YES". I guess I can't run it in xinetd and will have to put it somewhere in a startup rc...

david_ross 05-05-2003 07:12 PM

Sorry - I should have said that. I don't run vsftpd from xinetd.

Have you had a look to see if there is a port option in your /etc/xinetd.d/vsftpd file?

nuzzy 05-05-2003 07:16 PM

yeah...tried it and it didn't work...I rely so much on xinetd and inetd that I forget how to start a file on bootup...can you tell me how you have yours start up?

david_ross 05-05-2003 07:24 PM

You should have /etc/init.d/vsftpd if not it is below.

Just run:
chkconfig 35 vsftpd on

Assuming you want it to start in runlevels 3 & 5. Remember to stop it running from xinetd as well.

Code:

#!/bin/bash
#
# vsftpd      This shell script takes care of starting and stopping
#            standalone vsftpd.
#
# chkconfig: - 60 50
# description: Vsftpd is a ftp daemon, which is the program \
#              that answers incoming ftp service requests.
# processname: vsftpd
# config: /etc/vsftpd/vsftpd.conf

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -x /usr/sbin/vsftpd ] || exit 0

RETVAL=0
prog="vsftpd"

start() {
        # Start daemons.

        if [ -d /etc/vsftpd ] ; then
                declare -a sites
                sites=(`ls /etc/vsftpd/*.conf`)
                site_count=${#sites[@]}
                index=0

                while [ "${index}" -lt "${site_count}" ] ; do
                        site=`basename ${sites[${index}]} .conf`
                        echo -n $"Starting $prog for $site: "
                                ( /usr/sbin/vsftpd ${sites[${index}]} &)
                                daemon true
                                RETVAL=$?
                        echo
                        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
                        let "index = index + 1"
                done
        else
                RETVAL=1
        fi
        return $RETVAL
}

stop() {
        # Stop daemons.
        echo -n $"Shutting down $prog: "
        killproc $prog
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
        return $RETVAL
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart|reload)
        stop
        start
        RETVAL=$?
        ;;
  condrestart)
        if [ -f /var/lock/subsys/$prog ]; then
            stop
            start
            RETVAL=$?
        fi
        ;;
  status)
        status $prog
        RETVAL=$?
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|condrestart|status}"
        exit 1
esac

exit $RETVAL



All times are GMT -5. The time now is 03:25 AM.