Link to home
Start Free TrialLog in
Avatar of thomasm1948
thomasm1948Flag for United States of America

asked on

Centos vsftp

I am new to Linux and would like to setup an ftp server.  I have installed vsftpd server and so far if I try to login with a user account I get the user's home directory.

How can I create a single repository for:

 -  a group of users to upload but not see what they uploaded after they are done (write only)
 - a single user that can see all of the files uploaded to the repository (read, write, delete)

Thank you for your help in advance
Avatar of thomasm1948
thomasm1948
Flag of United States of America image

ASKER

OK,

I just tried the following:

usermod -d /ftpRepo testUser

This gives the user the ability to browse up into the directories.  How can I restrict and how can I grant only write only.  and for the manager read, write, delete
Avatar of Mazdajai
You can disable the dirlist option in vsftp, all directory list commands will give permission denied. Ultimately users will not able to run the list command and see what they uploaded.
dirlist_enable=NO

Open in new window

I tried that, but then I am unable to login.  I get an error indicating that I am not able to that permissions are denied
Can you post your vsftp.conf file?
you must be trying with "root" by default root is denied.. try with any normal user which is not listed in below files

/etc/vsftpd/ftpusers
/etc/vsftpd/user_list

TY/SA
I did I created new users
give me output of

#sestatus

#sestatus -b | grep -i ftp

TY/SA
here is my config

# 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=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
#
# The target log file can be vsftpd_log_file or xferlog_file.
# This depends on setting xferlog_std_format parameter
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
#
# The name of log file when xferlog_enable=YES and xferlog_std_format=YES
# WARNING - changing this filename affects /etc/logrotate.d/vsftpd.log
#xferlog_file=/var/log/xferlog
#
# Switches between logging into vsftpd_log_file and xferlog_file files.
# NO writes to vsftpd_log_file, YES to xferlog_file
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().
#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

pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
Is it possible to create one user to upload only and not see the directory and have one user that can see everything

I am stuck on this one
I also noticed that I cannot open the ftp site in explorer
When I run

sestatus -b | grep -i ftp

Nothing is displayed
I am enabling selinux now
[root@ProxySvr01 ~]# sestatus -b | grep i ftp
grep: ftp: No such file or directory
Don;t enable selinux


#sestatus

#sestatus -b | grep -i ftp  

(u forogt using "-" )

TY/SA
I get this:

[root@ProxySvr01 ~]# sestatus -b | grep -i ftp
allow_ftpd_anon_write                       off
allow_ftpd_full_access                      off
allow_ftpd_use_cifs                         off
allow_ftpd_use_nfs                          off
ftp_home_dir                                off
ftpd_connect_db                             off
ftpd_use_fusefs                             off
ftpd_use_passive_mode                       off
httpd_enable_ftp_server                     off
tftp_anon_write                             off
tftp_use_cifs                               off
tftp_use_nfs                                off


should I disable selinux
Attached is what I get for my test user
test-user-login.JPG
ASKER CERTIFIED SOLUTION
Avatar of Sandy
Sandy
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I get the same results as the image file

I ran
usermod -d /ftpRepo test1
usermod -d /ftpRepo test2

test1 is my user to upload fils only but cannot see whats in the folder
test2 is my user that should have full access to only that folder

both users should be able to move up in the directory

thank you for your help, if I can get those two users to work correctly it would be great.  So far they see the same thing.  the ftpRepo folder is empty right now so they both shouldn't see anything
sorry both users should not be able to move up into the other directories
is your ftp started working ?

TY/SA
The first image that I uploaded was from Internet explorer.  The attached is from firefox
firefox-error.JPG
vsftpd is started
no the two users are not working correctly
both users is Internet explorer sees all of the folders.  In firefox I et an error
ok, fixed the issue with home directories to point to ftpRepo.  Firefox still allows to move up into other directories and Internet explorer does not allow it.

still have an issue on how to enable test1 to only be able to upload files into the directory and not see anything in it even after they have uploaded the file

and I still have the issue that test2 should have full control of the folder.

I also noticed that I cannot open the ftp in file explorer to upload a file
OK,

So now I figure that I could give test2 ownership to the folder and that seems to work, but test1 one I am having trouble giving right permissions only.  I tried chmod 730 /ftpRepo and that did not work.  I also tried 772 with no success.  The last number I figure to be others and that id write only (2).

I get an error 500 OOPS: cannot change directory:
I think I got it.  I use chmod 773 /ftpRepo

I guess I needed execute along with read
I meant to say I needed execute with write
Hold I thought it was working but it seems to fail to upload the file for my test user.
I forgot to refresh it is working
Great. Are you all set now?
thank you for leading in the correct direction