LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   vsftpd problem (https://www.linuxquestions.org/questions/linux-networking-3/vsftpd-problem-452082/)

krneki 06-06-2006 08:07 AM

vsftpd problem
 
Hello!

I own a linux server where is installed Fedora Core 3. I recently installed ftp server vsftpd. It's now configured that every user in /home has rights to access to his own account (directory) with a full control. Everything works fine, except one thing. I would like to create a new user account with full access to public directory. That means if someone (anonymous) would enter to browser ftp://myip he would be redirected to public dir XY and able to download/list files (without upload permission). There would be also user ABC which would have all permissions only to dir XY (his home directory), so he could upload and delete files (if logged in of course). Is there any way to do that?

And another question related to domain name. It's actually very simply. I would like to have domain name (which I already registered on eurodns.com) for my ip. So if someone would enter ftp://mydomain it would be the same if entered only my IP address. How can I do that?

Thank you very much for further help.

Regards,
krneki

krneki 06-12-2006 08:27 AM

Here is the situation:
I chmod-ed /var/ftp/pub to 755 permissions. Anonymous users have now permission only to read and copy files from public dir. The user which I created with home directory on /var/ftp has exact permissions - only permission to view and copy files, but I get 500 error if I try to upload something.
However, that's not what I need. I still want to allow anonymous users to view files (without upload/delete permission) and created user to upload/delete/create/view permissions on public directory.
Maybe there is a trick with chroot and chmod?

zsoltrenyi 06-12-2006 11:07 AM

I used to know vsftpd and as far I remember it should have something with anonymous access in vsftpd.conf. Yeap. Man page says:

anonymous_enable
Controls whether anonymous logins are permitted or not. If enabled, both the usernames ftp and anonymous are recognised as anonymous logins.

Default: YES

anon_upload_enable
If set to YES, anonymous users will be permitted to upload files under certain conditions. For this to work, the option write_enable must be activated, and the anonymous ftp user must have write permission on desired upload locations.

Default: NO

krneki 06-13-2006 12:46 AM

Here is my config file. Is everything OK with settings?
Quote:

# Example config file /etc/vsftpd/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=YES
#
# 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=077
#
# 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=no
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
anon_mkdir_write_enable=no
#
# 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=ftp
#
# 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
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 turning on ascii_download_enable enables malicious remote parties
# to consume your I/O resources, by issuing the command "SIZE /big/file" in
# ASCII mode.
# These ASCII options are split into upload and download because you may wish
# to enable ASCII uploads (to prevent uploaded scripts etc. from breaking),
# without the DoS risk of SIZE and ASCII downloads. ASCII mangling should be
# on the client anyway..
ascii_upload_enable=YES
ascii_download_enable=YES
#
# You may fully customise the login banner string:
ftpd_banner=Welcome to bulek.be 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().
#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

pam_service_name=vsftpd
userlist_enable=YES
#enable for standalone mode
listen=YES
tcp_wrappers=YES
anon_root=/var/ftp/pub

Notwerk 06-13-2006 01:40 AM

Everything looks OK.

You might want to have another look at:
Quote:

# 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().
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
If you wish to lock local users inside their home directories (so that they cannot browse the entire filesystem over ftp).

[EDIT]
One more thing.
Quote:

local_umask=077
This means that local groups cannot read/write/execute any files after they are uploaded. You might want to change the value to something like local_umask=027 but it really depends on what priviliges are allowed to groups inside the users' home directories.
[/EDIT]

Notwerk 06-13-2006 02:00 AM

Just took another read of your post and realized i had missed something. If i understand correctly, you want to have a directory where one local user has full access, but when anonymous users login they get that same directory but only with read permissions, right?

If this is so, you'll need to create a new local user with a home directory and shell access. The settings in vsftpd.conf are already correct to allow this new user full access to his/her home directory. Next you'll need to set the anonymous user's root directory to the same home directory of the new local user.
Code:

anon_root=/home/new_local_user/
Again, the settings in vsftpd.conf are already correct to limit anonymous users access to only reading files.

Now for your next question regarding Domain Name.
Is your external IP (the one assigned by your ISP when you conenct to the internet) static and doesn't change each time you connect? Or is it dynamic and changes each time?

krneki 06-14-2006 07:41 AM

I considered Notwerk's proposition and here is what I get:
I made new user named ftp2 and change anon_root to /home/ftp2. User ftp2 can now login into his account and he has full control of home directory. The only problem is that anonymous users can't access to this directory (/home/ftp2). They everytime get error: "550 Failed to change directory". Anonymous users are still enabled in vsftpd.conf. I also tried to set 777 permissions to /home/ftp2 but nothing changed. Any new ideas?

Notwerk 06-14-2006 08:04 AM

Make sure you chmod /home/ftp2 recursively (change permissions on all files and directories inside it).

If there are sub-directories inside /home/ftp2 then you'll need to allow all users "execute" permissions on the directories, in order to permit them to see what's inside them.


All times are GMT -5. The time now is 12:33 AM.