LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 11-30-2010, 03:10 AM   #1
j.smith1981
Member
 
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161

Rep: Reputation: 1
Question 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
 
Old 11-30-2010, 10:45 AM   #2
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux
Posts: 2,851
Blog Entries: 1

Rep: Reputation: 901Reputation: 901Reputation: 901Reputation: 901Reputation: 901Reputation: 901Reputation: 901Reputation: 901
Doesnt this have something to do with DirFake or Alias or something similar?
 
Old 12-01-2010, 03:07 AM   #3
j.smith1981
Member
 
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161

Original Poster
Rep: Reputation: 1
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.
 
Old 12-01-2010, 03:25 AM   #4
prodev05
Member
 
Registered: Jul 2009
Location: Earth
Distribution: Unix & Linux Variants
Posts: 304

Rep: Reputation: 20
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
 
Old 12-11-2010, 01:21 PM   #5
j.smith1981
Member
 
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161

Original Poster
Rep: Reputation: 1
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.
 
Old 12-11-2010, 07:06 PM   #6
j.smith1981
Member
 
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161

Original Poster
Rep: Reputation: 1
This is just an example but doesnt want to work for some reason:

Quote:
ServerName ftp.myftpserver.com
ServerAdmin hostmaster@myftpserver.com
DefaultRoot /www
DefaultChdir /www
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.
 
Old 12-12-2010, 03:24 AM   #7
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,897

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
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
 
Old 12-12-2010, 07:16 AM   #8
j.smith1981
Member
 
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161

Original Poster
Rep: Reputation: 1
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.
 
Old 12-12-2010, 07:53 AM   #9
j.smith1981
Member
 
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161

Original Poster
Rep: Reputation: 1
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!
 
Old 12-12-2010, 01:30 PM   #10
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,897

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
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
 
Old 12-12-2010, 03:23 PM   #11
j.smith1981
Member
 
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161

Original Poster
Rep: Reputation: 1
Ah I will definately have a look.

Thanks,
Jez.
 
Old 12-12-2010, 04:41 PM   #12
j.smith1981
Member
 
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161

Original Poster
Rep: Reputation: 1
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 04:44 PM.
 
Old 12-13-2010, 02:35 AM   #13
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,897

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
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?
 
Old 12-13-2010, 02:59 AM   #14
j.smith1981
Member
 
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by bathory View Post
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 03:35 AM.
 
Old 12-13-2010, 03:22 AM   #15
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,897

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
With the proftpd.conf you posted above this is normal. You should use:
Code:
DefaultRoot ~ !adm !jeremy
DefaultRoot /www jeremy
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I set a user password to expire on a specific date? Linuxwho? Linux - Newbie 5 07-06-2009 01:40 PM
how to set ulimits for a specific user with no login shell polemon Linux - General 1 10-11-2007 03:54 AM
How can I set the permission on the home directory when creating an user crisostomo_enrico Solaris / OpenSolaris 4 09-26-2007 06:24 PM
Set group id,set user id? JAKK Slackware 3 06-15-2006 10:16 PM
How to view set-user-ID and set-group-ID Xris718 Linux - General 7 01-10-2004 01:44 PM


All times are GMT -5. The time now is 02:14 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration