You are not logged in.

#1 2012-02-27 10:38:26

Lockheed
Member
Registered: 2010-03-16
Posts: 1,550

[solved] vsftpd and virtual users

I configured proftpd daemon and I can connect to the server, but I cannot see anything being listed.
The username 'nik' is not a host machine user, but a virtual user, and it needs to access folder /mnt/Dysk_D with full rw access.

Here is my conf file:

ServerType standalone
DefaultServer on
Umask 022
ServerName "192.168.7.12"
ServerIdent on "Desknik FTP"
ServerAdmin email@example.org
IdentLookups off
UseReverseDNS off
Port 22
PassivePorts 49152 65534
#MasqueradeAddress None
TimesGMT off
MaxInstances 30
MaxLoginAttempts 3
TimeoutLogin 300
TimeoutNoTransfer 120
TimeoutIdle 120
DisplayLogin welcome.msg
DisplayChdir .message
User nobody
Group nobody
DirFakeUser off nobody
DirFakeGroup off nobody
DefaultTransferMode binary
AllowForeignAddress on
AllowRetrieveRestart on
AllowStoreRestart on
DeleteAbortedStores off
#TransferRate RETR 220
#TransferRate STOR 250
#TransferRate STOU 250
#TransferRate APPE 250
SystemLog /var/log/secure
RequireValidShell off
#<IfModule mod_tls.c>
#TLSEngine off
#TLSRequired off
#TLSVerifyClient off
#TLSProtocol SSLv23
#TLSLog /var/log/proftpd_tls.log
#TLSRSACertificateFile /etc/gadmin-proftpd/certs/cert.pem
#TLSRSACertificateKeyFile /etc/gadmin-proftpd/certs/key.pem
#TLSCACertificateFile /etc/gadmin-proftpd/certs/cacert.pem
#TLSRenegotiate required off
#TLSOptions AllowClientRenegotiation
#</IfModule>
#<IfModule mod_ratio.c>
#Ratios off
#SaveRatios off
#RatioFile "/restricted/proftpd_ratios"
#RatioTempFile "/restricted/proftpd_ratios_temp"
#CwdRatioMsg "Please upload first!"
#FileRatioErrMsg "FileRatio limit exceeded, upload something first..."
#ByteRatioErrMsg "ByteRatio limit exceeded, upload something first..."
#LeechRatioMsg "Your ratio is unlimited."
#</IfModule>
<Limit LOGIN>
  AllowUser nik
  DenyALL
</Limit>

<Anonymous /mnt/Dysk_D/>
User nik
Group group1
AnonRequirePassword on
MaxClients 10 "The server is full, hosting %m users"
DisplayLogin welcome.msg
DisplayChdir .msg
<Limit LOGIN>
Allow from All
Deny from all
</Limit>
AllowOverwrite on
<Limit LIST NLST  STOR STOU  APPE  RETR  RNFR RNTO  DELE  MKD XMKD SITE_MKDIR  RMD XRMD SITE_RMDIR  SITE  SITE_CHMOD  SITE_CHGRP  MTDM  PWD XPWD  SIZE  STAT  CWD XCWD  CDUP XCUP >
 AllowAll
</Limit>
<Limit NOTHING >
 DenyAll
</Limit>
</Anonymous>

Last edited by Lockheed (2012-03-02 23:34:25)

Offline

#2 2012-02-28 11:11:57

scar
Member
From: Hungary
Registered: 2009-10-01
Posts: 449

Re: [solved] vsftpd and virtual users

What about permissions on /mnt/Dysk_D?


“The future has already arrived. It's just not evenly distributed yet.”
― William Gibson

Offline

#3 2012-02-28 12:06:09

Lockheed
Member
Registered: 2010-03-16
Posts: 1,550

Re: [solved] vsftpd and virtual users

scar wrote:

What about permissions on /mnt/Dysk_D?

And what should they be?

Offline

#4 2012-02-28 12:10:16

scar
Member
From: Hungary
Registered: 2009-10-01
Posts: 449

Re: [solved] vsftpd and virtual users

They should be something the proftpd user can read/write.


“The future has already arrived. It's just not evenly distributed yet.”
― William Gibson

Offline

#5 2012-02-28 12:12:53

Lockheed
Member
Registered: 2010-03-16
Posts: 1,550

Re: [solved] vsftpd and virtual users

proftpd user doesn't exist in the system.

Offline

#6 2012-02-28 12:20:01

scar
Member
From: Hungary
Registered: 2009-10-01
Posts: 449

Re: [solved] vsftpd and virtual users

I mean your virtual "nik" user.


“The future has already arrived. It's just not evenly distributed yet.”
― William Gibson

Offline

#7 2012-02-28 12:20:55

hokasch
Member
Registered: 2007-09-23
Posts: 1,461

Re: [solved] vsftpd and virtual users

You set the user proftpd runs as in the config file. As scar said, this user must have access to the folder (because you are using virtual users).

edit: things might work differently in proftpd (I used vsftpd). http://www.proftpd.org/docs/howto/VirtualUsers.html

Last edited by hokasch (2012-02-28 12:22:48)

Offline

#8 2012-02-28 12:37:28

scar
Member
From: Hungary
Registered: 2009-10-01
Posts: 449

Re: [solved] vsftpd and virtual users

Yeah. Or you can try vsftpd too, which I use and find more straightforward to configure. Even with virtual users.

Last edited by scar (2012-02-28 12:40:24)


“The future has already arrived. It's just not evenly distributed yet.”
― William Gibson

Offline

#9 2012-02-28 18:41:17

Lockheed
Member
Registered: 2010-03-16
Posts: 1,550

Re: [solved] vsftpd and virtual users

I already tried vsftpd and failed because arch wiki is insufficient for setting up virtual users. Is there some howto that explains the process?

Offline

#10 2012-02-28 18:47:19

lifeafter2am
Member
From: 127.0.0.1
Registered: 2009-06-10
Posts: 1,332

Re: [solved] vsftpd and virtual users

Lockheed wrote:

I already tried vsftpd and failed because arch wiki is insufficient for setting up virtual users. Is there some howto that explains the process?

http://lifeafter2am.net/2011/05/vsftpd- … ual-users/

IIRC I just followed the wiki and maybe a little documentation from the vsftpd website.


#binarii @ irc.binarii.net
Matrix Server: https://matrix.binarii.net
-------------
Allan -> ArchBang is not supported because it is stupid.

Offline

#11 2012-02-28 19:47:16

Lockheed
Member
Registered: 2010-03-16
Posts: 1,550

Re: [solved] vsftpd and virtual users

I don't get it. I followed the guide to the letter, and now when I try to login I get 'incorrect user/password' while I know it is the same as in the db...

The only thing was I didn't have 'ftp' file in /etc/pam.d/ so I created it.

Last edited by Lockheed (2012-02-28 19:52:10)

Offline

#12 2012-02-29 08:53:11

Lockheed
Member
Registered: 2010-03-16
Posts: 1,550

Re: [solved] vsftpd and virtual users

Here's my vsftpd.conf

# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=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
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
#chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd with two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES
# Directory to lock virtual users into
local_root=/mnt/Dysk_D/
virtual_use_local_privs=YES
# Guest is what tells vsftpd to look in the pam database
guest_enable=YES
guest_username=virtual
listen_port=22

Offline

#13 2012-03-02 13:24:44

scar
Member
From: Hungary
Registered: 2009-10-01
Posts: 449

Re: [solved] vsftpd and virtual users

The vsftpd wiki page seems to be a bit obsolete to me - vsftpd changed lately.

I'm fighting to establish a clean virtual user config file too.

until then try to look around here: https://security.appspot.com/vsftpd.html


“The future has already arrived. It's just not evenly distributed yet.”
― William Gibson

Offline

#14 2012-03-02 23:33:41

Lockheed
Member
Registered: 2010-03-16
Posts: 1,550

Re: [solved] vsftpd and virtual users

Here's the right way to do it:
http://www.cyberciti.biz/tips/centos-re … users.html
Case closed.

Last edited by Lockheed (2012-03-02 23:34:48)

Offline

Board footer

Powered by FluxBB