Changing the ownership to a designated user will not change the users default home directory specified in passwd file. Anyhow, You may achieve this in different ways. But to make it simpler do this by opening up a terminal;
Firstly make a back-up of your /etc/passwd
file doing below;
sudo cp /etc/passwd /etc/passwd.back
Once done, edit the file (either with vi or nano), I prefer nano which is pretty easy;
sudo EDITOR=nano vipw /etc/passwd
Locate the created user. A line should reflect as below assuming the user is andrew
;
andrew:x:1001:1001:andrew:/home/andrew:/bin/sh
Replace /home/andrew
with /var/www/sitename.com
& save the file by hitting CTRL+O then enter to save & then CTRL+X to exit. This will direct the user to specified directory. Login as the user and see whether it points to **/var/www/sitename.com by also checking for any permission issues. If permission issue persists, then add the user to the www-data
group by doing below;
sudo adduser andrew www-data
EDIT: regarding the comment, I just had a quick search and found some more detail. Well, you may edit vsftpd.conf file located in /etc/
directory
sudo nano /etc/vsftpd.conf
un-comment (remove only the #
if its there at the beginning) the following line;
chroot_local_user=YES
Note: Just to be safe, make a back-up of the configuration file before you make any changes to it.
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.back
Source: vsftpd.conf on Ubuntu
Hope it helps!
The default umask is 022
, which allows group and others read permissions (and execute, where applicable) (or 002
if User Private Groups are enabled). If you have a problem with that being the default, file a bug. If you want to change the default, edit /etc/login.defs
and change
UMASK 022
to
UMASK 077
And then do:
chmod og-rx -R ~
Best Answer
To make folders in your home directory available for other users on the same computer (read/write), basically you need to do three things. The procedure for Lubuntu is quite the same as for Ubuntu, apart from the difference in the file browser.
1. Make other users member of the group: "yourusername"
gnome-system-tools
(NB: In Lubuntu, it already is installed) and use theusers and groups
-section.Manage groups > choose yourusername > properties >
add the other users by checking their checkboxes.The command line way (if you don't want to use / install
gnome-system-tools
) to add an existing user to group<yourname>
, is:2. Change the permissions of the folder you want to share:
On Ubuntu: right-click on the folder in nautilus and choose
properties
. In the permissions tab, change the group permissions for groupyourusername
toread & write
.Change the permissions for the files in the folder similarly (the button down in the nautilus properties window).
On Lubuntu: Change the permissions for the folder you'd like to share to at least read & write permissions for owner & group:
3.Set permissions for newly created files
Now you can access the shared folder from the other user's account(s) with full privileges to create and edit files and directories. However, if other users create new files, those files will be owned by the user who created them.
To give read, write and execute permissions (if the file is executable) on newly created files to all members of the group, there is still one thing left to do: run in a terminal (from the folder's owner account):