How to ftp directly into a subdirectory?


#1

I set private.mysite.com to remap to private.mysite.com/files. However, when I login I still see
three directories. mail, logs, and private.mysite.com. I then have to drill down. I do not want the ftp user to see the other directories. I just need them to go straight to the files directory.

Here is the response from support.

“The remapping is done when the sub-domain is served, not on the server file structure.”

I still don’t know what to do. I set the sub-domain to end in /files but that doesn’t help. Any thoughts?


#2

Your setup doesn’t make sense to me. It sounds like you’re trying to get your domain to actually show the contents of a subfolder in the domain. Unless these are really two separate (sub)domains.

However, you can create an FTP user with no associated domain and have their home directory remap to your domain:
www.mydomain.com/remapped” points to “/home/remappeduser/”

When remappeduser logs in via FTP, all they will see is their webcontent that’s remapped to your site.

You may even be able to remap this way (but I haven’t tried this):
remapped.mydomain.com/” points to “/home/remappeduser/” or
"www.mydomain.com/" points to “/home/remappeduser/”

-Scott


#3

I’d like to take a moment to clarify something.

DreamHost was trying to explain that since URL re-mapping only affects the way a web site works it will not make a difference when using FTP or SSH2.

If it simply a matter of being too lazy to change the current working directory, any real FTP client will allow you to configure it to do that for you automatically when logging in.

What you really want is FTP/SSH2 to be configured to specify the initial working directory to be that of a certain subdirectory instead of the root (FTP is chroot to home directory) or home directory (SSH2). DreamHost does not provide a way for you to modify the FTP or SSH2 configuration in this way though.

PS.

If you are using a client that supports FTP URLs, eg ftp://ftp.example.com/, then ftp://ftp.example.com/files should allow you to “FTP directory into a subdirectory”, but this is the same thing as telling the client to automatically change the current working directory when logging in.

Scott is incorrect. You may not re-map an HTTP URL to a home directory:
OK: http://example.com/files/ -> /home/user/files
NOT OK: http://example.com/files/ -> /home/user

Perhaps it helps to keep this in mind:
Home directories are used for all user files including mail, logs, configuration, private, and web directories.
Web sites use web directories to make files available over the web.
Mail, logs, configuration, and private files should never be available over the web.
A home directory should never be a web directory.
FTP and shell users access the home directory.

:cool: [color=#6600CC]Atropos[/color] | openvein.org


#4

If he does this, I hope he’s not on my server.


#5

[edit]Ok, duh, I should have experimented with the remapping before opening my trap.[/edit]

I never did try to remap a home directory to a website. I just now tried it and it didn’t let me. The original poster will have to create a user and a www directory in their home directory. Their home directory will be clean unless they own a domain or clutter it up.

I do have a user not associated with a domain. Aside from some data I store there, the directory’s clean: no logs, no mail, no configuration data, no domain directories.

I believe that the issue was that the original poster didn’t want the users to see extraneous data normally stored in a home directory. As Atropos7 suggested, my FTP client goes straight to my domain directory so I don’t see that extraneous data either.

-Scott


#6

I certainly grok the desire to make it easy and not confuse people. But security can’t be compromised for convenience. (Well, it can - but it shouldn’t)


#7

Thanks to all for helping me.

"What you really want is FTP/SSH2 to be configured to specify the initial working directory to be that of a certain subdirectory instead of the root (FTP is chroot to home directory) or home directory (SSH2). DreamHost does not provide a way for you to modify the FTP or SSH2 configuration in this way though. "

Yes that was what I was hoping for but realize that is not possible. Here is the way support put it:

“Each ftp user is a full unix user, so it’s not possible to hide the logs and Maildir directories or have them go directly into a sub-directory when they log in. It may be possible to setup something like this on the client side, but that’s something you’ll have to figure out yourself.”

I hope this thread will be of help to others trying this out.


#8

Rather than start a new thread on this one I’ll ask my question here. I now have the ftp user go to ftp.private.mydomain.com. When I use the ID and password I have permissions to delete files. However, when the same ID and PW used from the other person who wants to share files, they cannot delete? Surely, permissions are granted through the ftp user, and that hasn’t changed. What could be going on to prevent the same user on a different machine from deleting something they uploaded?


#9

Sorry, I don’t have a solution for your problem. I just wanted to add something to your previous problem (which was mine too, so…).

What I did to create a new ftp user: I created a new user (ftp only) in the webpanel. I didn’t give it any email address and added no domain to it. Than I just deleted the logs and Maildir. So now it is just an empty folder when this ftp user logs in. I guess if the logs folder should be needed (for some reason), the system will recreate it. But I am not going to use this user for anything else than uploading files, so I guess it won’t. But of course, I hope I didn’t mess anything up now…


#10

You may want to put a directory named .ssh in that directory and take away all permissions (and make it owned by someone else) to prevent abuse of ssh authentication.

Wholly