Set user home directory on Ubuntu / ProfFTP

Hi,

at my linux server I add users with this commands:
sudo useradd -m -s /bin/bash tuser
sudo passwd tuser

Now I like to give tuser access to a directory via FTP:
/var/www/tuser

The FTP demon is ProfFTP runing on Ubuntu 10.4 .
ProfFTP is not configured yet so I think is using default settings after insallation.

How can I do this?

Thanks

Andre
andre72Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

savoneCommented:
You can set a current users home directory like this:

sudo usermod -d /path/to/home username

You can also use the -d switch while adding th user like this:

sudo useradd -d /path/to/home -m -s /bin/bash username

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
florjanCommented:
You can make a folder called webroot or public_html and mount it with fstab. Don't forget to get user into docroot's group or chown it to him.
0
florjanCommented:
cd /home/tuser
su tuser
mkdir webroot
exit
nano -w /etc/fstab

Open in new window

now add this line at end
/home/tuser/webroot /var/www/tuser none bind 0 0 
ctrl + x
y
mount -a
chown -R tuser:tuser /var/www/tuser

Open in new window

This would do it
0
Webinar: Cyber Crime Becomes Big Business

The rising threat of malware-as-a-service is not one to be overlooked. Malware-as-a-service is growing and easily purchased from a full-service cyber-criminal store in a “Virus Depot” fashion. Join us in our upcoming webinar as we discuss how to best defend against these attacks!

andre72Author Commented:
@savone
This looks very interesting for accounts I will create in future but how about my existing ones?

@florian
I did any command like you wrote and get none error - but however it does not work ...
I'm sorry I'm a novice with Linux - do I need to restart ProfFTP or something else?
0
Dave BaldwinFixer of ProblemsCommented:
Aren't your users being created with a 'home' directory in '/home/tuser'?  That's where their FTP login should take them.  You could use Apache's default user directory setting of 'public_html' to give them their own web root.  See here: http://httpd.apache.org/docs/2.2/howto/public_html.html
0
andre72Author Commented:
The matter is that I've already set up  the www directories and created the users.
So tuser needs to have ftp access to /var/www/tuser as there's already his content.

If I understand the UserDir command right the directory will be translated to /home/tuser/public_html/ than which is useless for me.
0
Dave BaldwinFixer of ProblemsCommented:
You're basically right though you can change the name of the subdirectory.
0
andre72Author Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.