Solved

Centos vsftp

Posted on 2014-09-09
32
253 Views
Last Modified: 2014-09-11
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
0
Comment
Question by:thomasm1948
  • 24
  • 5
  • 3
32 Comments
 

Author Comment

by:thomasm1948
ID: 40312612
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
0
 
LVL 21

Expert Comment

by:Mazdajai
ID: 40313654
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

0
 

Author Comment

by:thomasm1948
ID: 40314260
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
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 21

Expert Comment

by:Mazdajai
ID: 40314320
Can you post your vsftp.conf file?
0
 
LVL 13

Expert Comment

by:Sandy
ID: 40314622
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
0
 

Author Comment

by:thomasm1948
ID: 40315028
I did I created new users
0
 
LVL 13

Expert Comment

by:Sandy
ID: 40315044
give me output of

#sestatus

#sestatus -b | grep -i ftp

TY/SA
0
 

Author Comment

by:thomasm1948
ID: 40315088
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
0
 

Author Comment

by:thomasm1948
ID: 40315091
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
0
 

Author Comment

by:thomasm1948
ID: 40315094
I also noticed that I cannot open the ftp site in explorer
0
 

Author Comment

by:thomasm1948
ID: 40315099
When I run

sestatus -b | grep -i ftp

Nothing is displayed
0
 

Author Comment

by:thomasm1948
ID: 40315124
I am enabling selinux now
0
 

Author Comment

by:thomasm1948
ID: 40315163
[root@ProxySvr01 ~]# sestatus -b | grep i ftp
grep: ftp: No such file or directory
0
 
LVL 13

Expert Comment

by:Sandy
ID: 40315171
Don;t enable selinux


#sestatus

#sestatus -b | grep -i ftp  

(u forogt using "-" )

TY/SA
0
 

Author Comment

by:thomasm1948
ID: 40315187
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
0
 

Author Comment

by:thomasm1948
ID: 40315195
Attached is what I get for my test user
test-user-login.JPG
0
 
LVL 13

Accepted Solution

by:
Sandy earned 500 total points
ID: 40315211
ok..

either run

#setenforce 0

or run

#setsebool -P allow_ftpd_full_access on
#setsebool -P ftp_home_dir on

TY/SA
0
 

Author Comment

by:thomasm1948
ID: 40315241
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
0
 

Author Comment

by:thomasm1948
ID: 40315243
sorry both users should not be able to move up into the other directories
0
 
LVL 13

Expert Comment

by:Sandy
ID: 40315255
is your ftp started working ?

TY/SA
0
 

Author Comment

by:thomasm1948
ID: 40315260
The first image that I uploaded was from Internet explorer.  The attached is from firefox
firefox-error.JPG
0
 

Author Comment

by:thomasm1948
ID: 40315262
vsftpd is started
0
 

Author Comment

by:thomasm1948
ID: 40315266
no the two users are not working correctly
0
 

Author Comment

by:thomasm1948
ID: 40315272
both users is Internet explorer sees all of the folders.  In firefox I et an error
0
 

Author Comment

by:thomasm1948
ID: 40315324
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
0
 

Author Comment

by:thomasm1948
ID: 40315695
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:
0
 

Author Comment

by:thomasm1948
ID: 40315702
I think I got it.  I use chmod 773 /ftpRepo

I guess I needed execute along with read
0
 

Author Comment

by:thomasm1948
ID: 40315721
I meant to say I needed execute with write
0
 

Author Comment

by:thomasm1948
ID: 40315729
Hold I thought it was working but it seems to fail to upload the file for my test user.
0
 

Author Comment

by:thomasm1948
ID: 40315730
I forgot to refresh it is working
0
 
LVL 21

Expert Comment

by:Mazdajai
ID: 40316039
Great. Are you all set now?
0
 

Author Closing Comment

by:thomasm1948
ID: 40317130
thank you for leading in the correct direction
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question