• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 702
  • Last Modified:

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
0
andre72
Asked:
andre72
  • 3
  • 2
  • 2
  • +1
3 Solutions
 
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
 
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: 10 Easy Ways to Lose a Password

Join us on June 27th at 8 am PDT to learn about the methods that hackers use to lift real, working credentials from even the most security-savvy employees. We'll cover the importance of multi-factor authentication and how these solutions can better protect your business!

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now