LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-07-2010, 08:26 AM   #1
c0pe
LQ Newbie
 
Registered: Jul 2010
Posts: 22

Rep: Reputation: 0
Question how to dump all users to the same sftp starting directory?


Hello,

Using CentOS 5.5. I have a handful of users that I need to have connect to my server via sftp and start in the same directory.

for example, user1, user2, user3, etc.. will connect via sftp and upon connection will all be in the /some/dir/path/ftp-root directory.

I know one way is to create these users all with the same 'home' directory, since by default a user starts in their home directory when connecting via sftp, but before just doing that, I wanted to find out if that is really the appropriate method to use? alternatives? Is there some setting on the sftp server end that could direct all users to one starting directory so that these users don't have to have the same 'home' dir? I'm using the sshd daemon that comes with CentOS 5.5 (with all current updates/patches).

any input would be appreciated.
 
Old 07-08-2010, 11:35 AM   #2
c0pe
LQ Newbie
 
Registered: Jul 2010
Posts: 22

Original Poster
Rep: Reputation: 0
no one? I didn't specify it was the openssh sftp-server module in use, but I assumed that would be implied by specifying I was using sshd. I think I'm going to create users with their own home directories and just put a link to what I essentially want to be the ftp root directory, that way they just have to navigate one level to get to where they should be. Creating several users all with the same home directory just smelled like trouble, not sure why because I'm not that experienced with linux, but that's why I posted here, hoping for some guidance. I was also considering changing the server side of my equation to use something else, like vsftpd, which may have more options for what I need, but another requirement I have is radius auth, which I already have working with my sshd/sftp-server setup, so I don't want to have to redo that with another server if I don't have to.

anyone? any answers to my original post/questions? how about my current plan (keeping separate home directories and just placing a link to the ftp root)?
 
Old 07-08-2010, 06:35 PM   #3
alpha01
Member
 
Registered: Jul 2008
Location: Orange County
Distribution: Ubuntu/Debian, CentOS, RHEL, FreeBSD, OS X
Posts: 75

Rep: Reputation: 19
I think it is possible to jailed SFTP users to their home directories.
http://undeadly.org/cgi?action=artic...20080220110039

But as far as I know, it's not officially supported by OpenSSH.
 
Old 07-09-2010, 01:08 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,360

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Depends exactly what you want. If the users only logon to upload/download to/from a common dir, just make one dir.
If you want/need separate home dirs for other reasons eg ssh access, then create all users in 1 group, but set home dirs to 700 perms and create a group owned/shared dir for ftp sharing eg 770 perms.

eg
Code:
drwx------ user1 ftp /home/usr1
drwx------ user2 ftp /home/usr2

chmod g+s /home/ftp
drwxrws--- ftp ftp /home/ftp
the g+s ensures all files created default to group owner ftp
 
Old 07-09-2010, 05:53 AM   #5
c0pe
LQ Newbie
 
Registered: Jul 2010
Posts: 22

Original Poster
Rep: Reputation: 0
thanks for the responses, it's appreciated. I'm not looking to restrict each user to their own home directory.

- I was looking to have *all* the users start in the same directory upon connecting to sftp. Like /foo/bar/ftproot. But the only way I could think of was by making all the users' home directories actually be /foo/bar/ftproot, and I don't know if having multiple users have the same home directory is a bad thing. In this case, these users only exist for the purpose of read/write sftp access into this /foo/bar/ftproot directory (and subdirectories), no shell access is required.

- having all files and directories created under /foo/bar/ftproot default to group owned is also desired... should I do that the way suggested already here, or should I use an sftp-server option? I think there was a umask option which sounded like it would take care of that also? or maybe that was only for the case of anonymous access?

- my 'plan B', because I am not sure about how to go about plan A, was to go ahead with each user having their own home directory and simply placing a link to /foo/bar/ftproot in each home directory. Not ideal due to having to navigate another layer down to get to what should really already be the 'starting point', but it would work.

should I go back to my plan A?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Chroot SFTP users frist44 Linux - Server 3 07-01-2009 04:40 PM
common directory for all sftp users goober3 Linux - Networking 2 08-30-2008 08:34 AM
od - Trying to get dump of directory idoneous Linux - Newbie 2 12-10-2006 12:54 PM
dump /home directory kingtas Linux - Software 3 09-11-2004 06:59 PM
Jailing SFTP Users to Home directory Jason_25 Linux - Networking 3 01-06-2002 08:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration