macsat.com OpenWrt and ASUS WL Forum
March 15, 2010, 10:53:27 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?
Login with username, password and session length
News: Back to macsat.com
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Any (easy) way to change vsftpd default settings?  (Read 339 times)
0 Members and 1 Guest are viewing this topic.
jimcpl
Jr. Member
**
Offline Offline

Posts: 75


View Profile
« on: February 02, 2010, 17:14:49 PM »

Hi,

This is a followup to my earlier post about vsftpd.

It looks like the default settings for vsftpd.conf have anonymous access enabled. 

I was able to change those settings by editing vsftpd.conf, killing the running vsftpd processes, and then starting vsftpd again using 'nohup vsftpd &', but I think that when I reboot the SMCWAPS-G (with Schufti's firmware), that the vsftpd.conf will be reloaded from ROM or something, and set back to allow anonymous access.

The reason I'm asking is that I had an incident yesterday/last night, when I was getting a bunch of login attempts to the SMCWAPS-G vsftpd. 

Luckily I had disabled anonymous FTP per the above before that, but now, I'm really worried about even rebooting the SMCWAPS-G, because that'll enable anonymous again, and it's a real pain having to modify vsftpd.conf everytime I power up the SMCWAPS-G.

BTW, I have an autoexec on my C drive, and I have some scripting in there to setup the LPD, so maybe I can overwrite the /etc/vsftpd.conf from the autoexec?

Jim
Logged
jimcpl
Jr. Member
**
Offline Offline

Posts: 75


View Profile
« Reply #1 on: February 02, 2010, 17:40:16 PM »

Hi,

I tried modifying vsftpd.conf, and putting a copy on my C drive, then adding:

cp /mnt/C/boot-safe-vsftpd.conf /var/config/vsftpd.conf

in my autoexec.

It looks like it actually copied the safer vsftpd.conf to /var/config/vsftpd.conf when I reboot, BUT it looks like the vsftpd that is running after the reboot is STILL the ORIGINAL vsftpd.conf.

I'm guessing that vsftpd is being started BEFORE the autoexec shell script gets executed?

So, is there any other way to change the vsftpd settings BEFORE the vsftpd gets started after a boot?

Thanks,
Jim
Logged
jimcpl
Jr. Member
**
Offline Offline

Posts: 75


View Profile
« Reply #2 on: February 02, 2010, 18:32:52 PM »

Hi,

I found this:

http://www.macsat.com/macsat/component/option,com_smf/Itemid,50/topic,717.0/

Unfortunately, I tried adding a "sleep 5" before the cp of the vsftpd.conf, but it's still not using the 'safer' vsftpd.conf Sad...

Here's my autoexec now:

# cat /mnt/C/autoexec
#!/bin/sh
sleep 5
cp /mnt/C/boot-safe-vsftpd.conf /var/config/vsftpd.conf

mkdir /etc/mini-lpd/lp
cd /etc/mini-lpd/lp
ln -s /dev/usblp0 device
cd /tmp
nohup mini-lpd &

Jim
Logged
Ernst
Full Member
***
Offline Offline

Posts: 112



View Profile
« Reply #3 on: February 02, 2010, 20:48:27 PM »

Why not kill the process vsftpd, do the copy of the new conf file and restart it?

Or, even better, from the man page of vsftpd:

"vsftpd.conf may be used to control various aspects of vsftpd's behaviour. By default, vsftpd looks for this file at the location /etc/vsftpd.conf. However, you may override this by specifying a command line argument to vsftpd. The command line argument is the pathname of the configuration file for vsftpd."

So, kill the vsftpd daemon from your autoexec and restart if with a command-line:

vsftpd [path to your new conf file, on your harddisk somewhere]

Easy!
Logged
jimcpl
Jr. Member
**
Offline Offline

Posts: 75


View Profile
« Reply #4 on: February 02, 2010, 21:08:16 PM »

Ernst,

Thanks, but that means that, like my putting the copying of the 'safer' vsftpd.conf in the autoexec, what you're suggesting means that, if I just want to ALWAYS use the safer vsftpd.conf, I have to telnet into the SMCWAPS-G everytime I start it to kill vsftpd and restart it.

That (having to do this manually) is what I was trying to avoid.  I'd like to have the safer vsftpd.conf all the time, automatically.

What puzzles me also is on the Airlive webgui, the "guest" is UNCHECKED.  I'd think that that should have disabled anonymous and ftp users from logging into FTP?

Jim
Logged
jimcpl
Jr. Member
**
Offline Offline

Posts: 75


View Profile
« Reply #5 on: February 02, 2010, 21:10:29 PM »

Ernst,

I re-read your suggestion.  The problem is with killing vsftpd in the autoexec.

'kill' seems to only take a PID, so that means I'd have to be able to know the PID in the autoexec?

Jim
Logged
jimcpl
Jr. Member
**
Offline Offline

Posts: 75


View Profile
« Reply #6 on: February 02, 2010, 21:26:56 PM »

Hi,

I think that this works in autoexec:

Code:
#!/bin/sh
cp /mnt/C/boot-safe-vsftpd.conf /var/config/vsftpd.conf
kill -HUP `pidof vsftpd`

mkdir /etc/mini-lpd/lp
cd /etc/mini-lpd/lp
ln -s /dev/usblp0 device
cd /tmp
nohup mini-lpd &

I think that the above copies the safe vsftpd.conf to /var/config/vsftpd.conf, then it does a kill 'HUP' on the PID of the vsftpd process, which causes vsftpd to re-read the current (safer) /var/config/vsftpd.conf.

One ODDITY that MUST be noted is that it appears that when you use the Airlive webgui to make any changes in the FTP configuration (e.g., adding users, adding directories, etc.), it looks like the vsftpd daemon/process is restarted, and when it's restarted, THE ORIGINAL VSFTPD.CONF is COPIED INTO /var/config/vsftpd.conf, and the vsftpd process appears to pick up the ORIGINAL 'UNSAFE' vsftpd.conf!!

Jim
Logged
jimcpl
Jr. Member
**
Offline Offline

Posts: 75


View Profile
« Reply #7 on: February 02, 2010, 21:28:36 PM »

P.S.  So, I guess that the SAFE thing to do is that if you make any changes to the FTP settings using the webgui, then always do a reboot after that.

Jim
Logged
jimcpl
Jr. Member
**
Offline Offline

Posts: 75


View Profile
« Reply #8 on: February 02, 2010, 22:00:42 PM »

P.P.S.  The characters around the pidof are backwards apostrophes...

Jim
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

English Steel 1.6 © Saxon North Technologies
Powered by MySQL Powered by PHP Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!
Page created in 0.046 seconds with 24 queries.