You are not logged in.
i need create ftp accounts for users with access only to their app directory, can i do that?
thanks!
Offline
Hello,
> i need create ftp accounts for users with access only to their app directory, can i do that?
Yes, you can do this. Here's one way:
You can create FTP user via the WebFaction control panel ("Account" --> "ssh/sftp users"). When you create the user, select "/bin/bash" as the shell.
Each user you create gets their own home directory. You can use this home directory to store their webapp.
After you create the FTP user, you must then grant access to apache. You will probably also want to be able to control all of the FTP user's files from your main user. Also, to keep your sanity, you should preserve full control for the FTP user for all files that are created in their home directory. You can do these things by logging into SSH as the FTP user and running the following commands:
# This grants access to Apache:
setfacl -R -m default:u:apache:rx /home/$USER
setfacl -R -m u:apache:rx /home/$USER
# This grants full control to the main user:
setfacl -R -m default:u:YourMainUsername:rwx /home/$USER
setfacl -R -m u:YourMainUsername:rwx /home/$USER
# This preserves full control for the FTP user, no matter who creates files:
setfacl -R -m default:u:$USER:rwx /home/$USER
setfacl -R -m u:$USER:rwx /home/$USER
After you have done the steps above, you then need to register the FTP user's home directory as a web app. You do this by creating a Symbolic Link application in the WebFaction control panel. In the "Extra Info" box of the Symbolic Link app, put the full path to the FTP user's home directory (for example, /home/TheFtpUser). Finally, attach the newly created Symbolic Link app to a Site.
The user is then able to upload their webapp to their home directory using FTP.
Tip: If you have to transfer some files from your main account to the FTP user's home directory, COPY the files (with the 'cp' command) -- don't move them over (with the 'mv'). This will keep the file permissions correct.![]()
~Chris Sebastian
Last edited by likebike (2008-06-24 10:07:23)
Offline
Update: WebApps are no longer allowed to be served outside of the main user's home directory, so you can't use a Symbolic Link to point out to an FTP user's home directory. Instead, you need to do something like this:
/home/$FTPUSER/theapp --> /home/$MAINUSER/$FTPUSER
In other words, you must create a symbolic link from the FTP user's home directory to the main user's home directory. This will appear to the FTP user that the app resides in the 'theapp' folder in their home directory, when in reality, the app will reside in the main user's "$FTPUSER" directory.
See this 'setfacl' article for more info:
https://help.webfaction.com/index.php?_ … &nav=0
~Christopher Sebastian
Last edited by likebike (2009-01-28 07:41:58)
Offline
Here are some more detailed instructions about how to accomplish this, using the "new" approach (keeping the files in the main user's home directory):
I have created an SSH/FTP user call 'flowers'. I want to allow the 'flowers' user to manage their own webapp in their 'www' subdirectory (/home/flowers/www).
I have also created a 'flowers' app of type "Static/CGI/PHP" from the WebFaction Control Panel.
Here is what I need to do to link /home/flowers/www to the 'flowers' app that I created:
#RUN THESE IN SSH AS YOUR MAIN USER:
[chris@web123 ~]$ setfacl -m u:flowers:x ~
[chris@web123 ~]$ setfacl -R -m u:flowers:rwx ~/webapps/flowers
[chris@web123 ~]$ setfacl -R -m d:u:flowers:rwx ~/webapps/flowers
[chris@web123 ~]$ setfacl -R -m d:u:chris:rwx ~/webapps/flowers
# RUN THESE IN SSH AS YOUR FTP USER:
[flowers@web123 ~]$ ln -s /home/chris/webapps/flowers www
Finally, hook your 'flowers' app up to a WebSite by using the WebFaction Control Panel.
Now, your 'flowers' user will be able to control the contents of the website from their 'www' symlink.
~Christopher S.
WebFaction Support
Offline
Thanks for this info - however, it would be extremely useful if you could set this up when creating a new SSH/SFTP user. Perhaps a dropdown to select an existing webapp to give access to. I don't think all of these steps should be required for setting up an additional FTP user.
Or, you could use the virtual FTP accounts with 'user@domain.com' usernames - then an SSH account would not be required.
Offline
thanks Christopher ,thats helpme a lot
Offline
Excellent! This is exactly what I needed. Ideally, this should be in the kb (if it isn't already).
Offline
Thanks very much for this handy guide!
Offline
This doesn't seem to be quarantining them to certain directories. They still have read access from the main users ~ directory. They can see and read the other apps there
Offline
All good, I followed the links you mentioned and worked it out. RTFM! Cheers again!
Offline
likebike,
Thanks a lot for your post about how to deal with adding access for new ftp users.
By any chance is there a way to totally quarantine those additional ftp users so that they can't even read my other webapps?
This line just concerns me a bit:
setfacl -m u:flowers:x ~
Offline
Ravivmg,
If you want to keep your FTP users isolated, and unable to see your home directory contents, then you will need to use the "old" procedure, which is the post #2 in this thread (posted by me on 2008-06-18 12:42:08). Basically, you'll need to keep the FTP users in their own home directories, and not share yours.
The reason the procedure is known as the "old" procedure is because it works on some of our web servers, but not on others. I believe it should work on your server. (Specifically, I think the 'old' procedure works on Apache servers, but not Nginx servers.)
Any questions?
Regards,
Christopher S.
WebFaction Support
Offline
First, I am very happy with WebFaction, however, I think this is a very weak area in their service. I have my RHCT and am no bash newbie but setfacl has always been a mysterious and laborious command to me. I feel that it is unreasonable for this not to be automated somehow using the control panel. I have used other web panels that allow you to give isolated ftp access to individual users with ease. It seems uncharacteristic of WebFaction to not have this accomplished.
Last edited by jn325 (2009-06-01 09:03:23)
Offline
This is actually on our (quite long) todo list ![]()
All I can say is that we're working on it, but there is no set date for deploying this feature yet.
Offline
This couldn't be accomplished, a bit easier if we, in some how, could set/change the home dirs of the users, For example, to the one where the webapp is?
In linux you can do this, at least in some distros.
Offline
Me again...
I think that you should change the way the extra users are added/configured in the servers, one thing is, as I said before, to set the home dire to one inside the master home dir. And the other thing that I'm seeing right now, is that you should jail all the users to their home dirs, including ssh..., I'm connected via ssh, and I could go to the /etc dir, and see all the config files of the server, including the passwd file, where are all the users data configured in the server...., so, one person that have bad intentions, could try to stole accounts of the server, etc, etc... or not?
Besides that, this is my first day being a WebFaction client, and I'm pretty happy with the services ![]()
Thanks
Offline
Yes I was going to come here and say thank you for the wonderful information, I was able to setup a FTP/Sym link for a user to access a joomla site.
My concerns are similar to above, though, in that when I logged in as the new user via SFTP, I noticed I was able to peruse all the webapp directories, which made me wonder about security issues. Far from an expert on file permission levels, I want to avoid any potential problems with users acessing offlimit files.
Is there a blanket CHMOD I can set all the files and sub directories too that will protect me from this without affecting the execution of PhP scripts, or does the USER/GROUP listing (which still shows as main User) protect me from this without changing the individual permissions??
Thanks a ton for the thread-- worked great so far!
----------------------------------------------------------
Hmmm... just noticed I didn't follow directions 100% accurately, I just gave access for the new user to a STATIC/CGI/PHP app that I already had setup, not a Sym Link (ooops!). Is this the reason I could access the other directories?? I will delete the user and create a new app and repeat the process to see, but either way, would appreciate any feedback you might have to offer-- thanks again!
Last edited by ericdeaver (2009-07-20 00:09:05)
Offline
You could peruse the other webapps directories because you had not denied the extra user access to those directories.
If you want to grant access to only a single webapp directory, and keep the extra user out of all of the other webapp directories:
setfacl -m u:flowers:--x ~ setfacl -R -m u:flowers:--- ~/webapps/* setfacl -R -m d:u:flowers:--- ~/webapps/* setfacl -R -m u:flowers:rwx ~/webapps/flowers setfacl -R -m d:u:flowers:rwx ~/webapps/flowers
When that's done, 'flowers' will be able to see all of the directories in ~/webapps but the only one he'll be able to peruse is ~/webapps/flowers.
Offline
Awesome! Thanks.
Offline
Just throwing in that I too would love if this was easier to accomplish.
I love webfaction, and would love to recommend it to clients, but general usability issues with the panel and the difficulty in creating users and granting them access to specific section of the site prevent me from doing this.
Offline
I may create a new topic for this, but I this was the closest match I found to my question, so I thought I should start here...
I'm not looking to do this for FTP, but for multiple users to have full read/write execute permissions on the main account's webapp directories and home directory. I thought I knew how to do this, as the new users (jim and brian) are both members of the main accounts group, and I gave the group level read/write access to everything in home. They can execute files there, and if they do an ls on an EXACT file name, it will confirm that file is present, but they can't run ls on the directory, permission is denied. First I thought, oh, they just need to make the main account's group active with newgrp. No luck. I'm pretty puzzled. What I want isn't really that hard, is it? We have a few people who will work on the site, and they shouldn't all have to share a password to have access to the main account, yet it seems like they have to right now. Help is much appreciated!
Offline
OK, apologies, addressed problem with setfacl article here: https://help.webfaction.com/index.php?_ … p;nav=0,15
Think I must have been missing some executable permissions, but weird as that was the one thing they all seemed to have... it seems to have added a lot of +'s when I did setfacl for the group, forget what they mean.
Also, as long as I'm bothering admins (sort of), is Python2.6/Django1.1 auto install coming soon? How hard would it be for me to modify existing 2.5 script to work on 2.6, to learn WebFaction APIs? Also, is there any plans/interest in a script for pinax? I'm not sure how to get an existing script to try modifying it, but I'd like to. Thanks!
Last edited by bglusman (2009-08-22 07:39:16)
Offline
Hi,
Also, as long as I'm bothering admins (sort of), is Python2.6/Django1.1 auto install coming soon?
As far as I am aware we don't have a set date for Python 2.6 version of our applications yet.
You can do it yourself for now with instructions from here: http://forum.webfaction.com/viewtopic.p … 9341#p9341
Also, is there any plans/interest in a script for pinax?
We have had requests for a Pinax installer. Again, it's on our todo list but isn't the highest priority right now.
Regards,
David L.
WebFaction Support
--
WebFaction - Smarter web hosting
http://webfaction.com - http://twitter.com/webfaction
Offline
FYI we now have docs for this at http://docs.webfaction.com/software/gen … ific-users
Offline