Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
11-30-2010, 04:10 AM
|
#1
|
Member
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161
Rep:
|
How do I set a real system user in ProFTP to set to a specific directory?
I appreciate the subject field might be slightly vague, but here we go:
I have a real system user say 'test', created in a number of system groups, up to 3 additional groups (including ftp of course).
Its set to the usual standard directory /home/test.
But what if I wanted to use /home/test as their home directory but login to what would be unknown to them to be ProFTP to make them go in say /mywebdirectoryroot/mydomain.com or something random like that, how is this done?
Just been through things like this:
Quote:
<VirtualHost 192.168.0.255>
ServerName "ftp.mydomain.com"
ServerAdmin "me@localhost"
Port 22
User test
Group test
DefaultRoot /mywebdirectoryroot/mydomain.com
</VirtualHost>
|
But nothing seems to work, I know I can do this as I have done it before but would be great if someone could enlighten me as to how to go about doing this lol
|
|
|
11-30-2010, 11:45 AM
|
#2
|
Senior Member
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278
|
Doesnt this have something to do with DirFake or Alias or something similar?
|
|
|
12-01-2010, 04:07 AM
|
#3
|
Member
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161
Original Poster
Rep:
|
I dont know in all honesty, but going by logic; it should work.
Will see how that affects it.
Then if not I will post back the config of the edited vhost and see what maybe you or someone else thinks.
Thanks for your reply though,
Jez.
|
|
|
12-01-2010, 04:25 AM
|
#4
|
Member
Registered: Jul 2009
Location: Planet Earth
Distribution: Unix & Linux Variants
Posts: 304
Rep:
|
dude,
0) FTP's core directory is /var/ftp/pub/. Moment the ftp user is logging into the account, the core working dir is switched to the "/var/ftp/pub/<userid>'.
1) If you want to change it, please create a soft link to the folder from '/home/test' to '/var/ftp/pub/test' :P
2) once created the soft link your problem is solved. Now all the file will be located into the home dir.
reg
|
|
|
12-11-2010, 02:21 PM
|
#5
|
Member
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161
Original Poster
Rep:
|
I am really having no luck with this at all.
I didnt have to setup any kind of soft link, I really wish I had posted details of my configs on a blog to get this fixated in my head (really wish I had).
Is there any other way than creating a soft link?
There has to be since the first time I set one up without a soft link worked but just bashing my head now.
Any helps appreciated,
Jez.
|
|
|
12-11-2010, 08:06 PM
|
#6
|
Member
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161
Original Poster
Rep:
|
This is just an example but doesnt want to work for some reason:
If I say have a user called: myuser
So their home directory is /home/myuser
But I want when they login to their ftp account, I want them to just see whats in the folder /www not their home directory, how can this be done?
Sorry I just dont think I explained this well enough before, any hints are much appreciated as the above config just doesnt want to work!
This is when i really wish id posted when i got it working before wiping it.
|
|
|
12-12-2010, 04:24 AM
|
#7
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,220
|
Hi,
You can create a new group (myuser) and make your user the only member to that group.
After that you can use:
Code:
ServerName ftp.myftpserver.com
ServerAdmin hostmaster@myftpserver.com
DefaultRoot /www myuser
If that doesn't work, could you give more details, like what's happening when you're trying to login, ftp logs etc.
Regards
|
|
|
12-12-2010, 08:16 AM
|
#8
|
Member
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161
Original Poster
Rep:
|
Thats not exactly what I was after though.
I know I did this but it wouldnt allow me to edit files of other websites, as I want myuser to be the root user for all of those websites, located in the /www folder, sorry the whole essence of me wanting to do it like this.
|
|
|
12-12-2010, 08:53 AM
|
#9
|
Member
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161
Original Poster
Rep:
|
Right to make sense of this:
I already have the real username jeremy with the groupname jeremy yea?
If I allow that one group to be able to access /www there is no other users part of this group what so ever, but the user is assigned to /home/jeremy but thats just the shell login folder as such.
That should work shouldnt it?
If not I really dont see how any other configs would work, though I am pretty sure I have attempted this before and it didnt work, still kept taking the user to the home directory.
Its like something is overwriting the configs!
|
|
|
12-12-2010, 02:30 PM
|
#10
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,220
|
Check proftpd.conf to see if you have another DefaultRoot that overwrites this one. Or post it here so we can check if it's correct.
Also note that you can add another DefaultRoot for the rest of your users:
Code:
DefaultRoot ~ !jeremy
DefaultRoot /www jeremy
|
|
|
12-12-2010, 04:23 PM
|
#11
|
Member
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161
Original Poster
Rep:
|
Ah I will definately have a look.
Thanks,
Jez.
|
|
|
12-12-2010, 05:41 PM
|
#12
|
Member
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161
Original Poster
Rep:
|
Still doesnt want to work the way I want it to, really not sure what to do now.
If this helps anymore I have this as my configuration file:
Quote:
# This is the ProFTPD configuration file
# $Id: proftpd.conf,v 1.1 2004/02/26 17:54:30 thias Exp $
ServerName "FTP Server"
ServerIdent on "FTP Server ready."
ServerAdmin root@localhost
ServerType standalone
#ServerType inetd
DefaultServer on
AccessGrantMsg "User %u logged in."
#DisplayConnect /etc/ftpissue
#DisplayLogin /etc/ftpmotd
#DisplayGoAway /etc/ftpgoaway
DeferWelcome off
# Use this to excude users from the chroot
DefaultRoot ~ !adm
# Use pam to authenticate (default) and be authoritative
AuthPAMConfig proftpd
AuthOrder mod_auth_pam.c* mod_auth_unix.c
# Do not perform ident nor DNS lookups (hangs when the port is filtered)
IdentLookups off
UseReverseDNS off
# Port 21 is the standard FTP port.
Port 21
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask 022
# Default to show dot files in directory listings
ListOptions "-a"
# See Configuration.html for these (here are the default values)
#MultilineRFC2228 off
#RootLogin off
#LoginPasswordPrompt on
#MaxLoginAttempts 3
#MaxClientsPerHost none
#AllowForeignAddress off # For FXP
# Allow to resume not only the downloads but the uploads too
AllowRetrieveRestart on
AllowStoreRestart on
# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd)
MaxInstances 20
# Set the user and group that the server normally runs at.
User nobody
Group nobody
# Disable sendfile by default since it breaks displaying the download speeds in
# ftptop and ftpwho
UseSendfile no
# This is where we want to put the pid file
ScoreboardFile /var/run/proftpd.score
# Normally, we want users to do a few things.
<Global>
AllowOverwrite yes
<Limit ALL SITE_CHMOD>
AllowAll
</Limit>
</Global>
# Define the log formats
LogFormat default "%h %l %u %t \"%r\" %s %b"
LogFormat auth "%v [%P] %h %t \"%r\" %s"
# TLS
# Explained at http://www.castaglia.org/proftpd/modules/mod_tls.html
#TLSEngine on
#TLSRequired on
#TLSRSACertificateFile /etc/pki/tls/certs/proftpd.pem
#TLSRSACertificateKeyFile /etc/pki/tls/certs/proftpd.pem
#TLSCipherSuite ALL:!ADH:!DES
#TLSOptions NoCertRequest
#TLSVerifyClient off
##TLSRenegotiate ctrl 3600 data 512000 required off timeout 300
#TLSLog /var/log/proftpd/tls.log
# SQL authentication Dynamic Shared Object (DSO) loading
# See README.DSO and howto/DSO.html for more details.
#<IfModule mod_dso.c>
# LoadModule mod_sql.c
# LoadModule mod_sql_mysql.c
# LoadModule mod_sql_postgres.c
#</IfModule>
# A basic anonymous configuration, with an upload directory.
#<Anonymous ~ftp>
# User ftp
# Group ftp
# AccessGrantMsg "Anonymous login ok, restrictions apply."
# # We want clients to be able to login with "anonymous" as well as "ftp"
# UserAlias anonymous ftp
# # Limit the maximum number of anonymous logins
# MaxClients 10 "Sorry, max %m users -- try again later"
#
# # Put the user into /pub right after login
# DefaultChdir /pub
#
# # We want 'welcome.msg' displayed at login, '.message' displayed in
# # each newly chdired directory and tell users to read README* files.
# DisplayLogin /welcome.msg
# DisplayFirstChdir .message
# DisplayReadme README*
#
# # Some more cosmetic and not vital stuff
# DirFakeUser on ftp
# DirFakeGroup on ftp
#
# # Limit WRITE everywhere in the anonymous chroot
# <Limit WRITE SITE_CHMOD>
# DenyAll
# </Limit>
#
# # An upload directory that allows storing files but not retrieving
# # or creating directories.
# <Directory uploads/*>
# AllowOverwrite no
# <Limit READ>
# DenyAll
# </Limit>
#
# <Limit STOR>
# AllowAll
# </Limit>
# </Directory>
#
# # Don't write anonymous accesses to the system wtmp file (good idea!)
# WtmpLog off
#
# # Logging for the anonymous transfers
# ExtendedLog /var/log/proftpd/access.log WRITE,READ default
# ExtendedLog /var/log/proftpd/auth.log AUTH auth
#
#</Anonymous>
|
I really dont know what to do now, deleted the virtual hosts, just wondered if there's anything I need to do with the defaults?
But I have tried using !jeremy for excluding of users from chroot etc but still yea doesnt work at all.
Any helps appreciated,
Jez
Last edited by j.smith1981; 12-12-2010 at 05:44 PM.
|
|
|
12-13-2010, 03:35 AM
|
#13
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,220
|
Quote:
But I have tried using !jeremy for excluding of users from chroot etc but still yea doesnt work at all.
|
You said that your user homedir is /home/jeremy. This is used when the user tries to login using ssh for example. If you change proftpd Defaultroot to /www for jeremy, then the user logs into /www when using ftp.
So I cannot understand what exactly is your problem?
|
|
|
12-13-2010, 03:59 AM
|
#14
|
Member
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161
Original Poster
Rep:
|
Quote:
Originally Posted by bathory
You said that your user homedir is /home/jeremy. This is used when the user tries to login using ssh for example. If you change proftpd Defaultroot to /www for jeremy, then the user logs into /www when using ftp.
So I cannot understand what exactly is your problem?
|
The problem is it doesnt want to work.
It keeps putting the user in their home directory, I want the user to go to /www as I have said before, thats the problem I have been explaining all the time.
Maybe thats an option I did not set, but can tell you all that I have done definately did not work at all.
Last edited by j.smith1981; 12-13-2010 at 04:35 AM.
|
|
|
12-13-2010, 04:22 AM
|
#15
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,220
|
With the proftpd.conf you posted above this is normal. You should use:
Code:
DefaultRoot ~ !adm !jeremy
DefaultRoot /www jeremy
|
|
|
All times are GMT -5. The time now is 05:51 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|