LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-06-2014, 03:57 PM   #1
ratotopi
Member
 
Registered: Dec 2011
Posts: 114

Rep: Reputation: 6
is it possible to SFTP and FTP to same directory ?


Here are the step I did and I am having problem resolving this issue,
I created chrooted directory for sftp and the ChrootedDrectory looks like this
Match Group sftp
ForceCommand internal-sftp
AllowTcpForwarding no
ChrootDirectory /chroot/home/%u


I added sftp user with
useradd -g sftp -d /sftp user

The /chroot/home directory is own by root:root and chmod is 755, as required by chrooted sftp.When I sftp to the server as the user everything works fine and I am able to do the sftp without any problem as it takes me directly to the /sftp directory of the user.
My problem arises when I need to make same user ftp to the same directory /chroot/home/user/sftp
but when i do ftp to the server with that username it come back with no /sftp directory
so I change the home directory of user to
usermod -d /chroot/home/user/sftp user

I am able to ftp to the directory /sftp directly and ftp is ok
but now another problem comes when I do the sftp as the same user it will not take me to /sftp directory of the user but his /chroot/home/user directory which is own by root and sftp does not allow to do anything inside that directory you will have to cd to /sftp of the user directory before you do anything. My question is, can the user directly sftp or ftp to /chroot/home/user/sftp directory without having this issue, the user should not have to login as sftp user@server:/sftp or cd to /sftp directory after login from sftp. I tried to change user bashrc and profile file to cd to /sftp once they login but it does not work. I will be very thankful for any idea you can provide. How can I achieve user with sftp and ftp to able to work on same directory once they login. Thank you very much.

Last edited by ratotopi; 09-06-2014 at 04:00 PM.
 
Old 09-06-2014, 04:30 PM   #2
wpeckham
Senior Member
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, Vsido, tinycore, Q4OS
Posts: 1,797

Rep: Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619
ftp and sftp - WITH CHROOT

What you want to do IS possible, but you need to use tools that understand chroot the same way, and set them up to work with the same rule.

I assume, form the detail you provided, that you are using OpenSSH for your sftp server.
What is your ftp server? Have you read the documentation re: CHROOT for that package?

I would set it up so SFTP works perfectly, then leave that side alone and change your FTP server. VSFTP is one that should support your configuration, and should be in most REPOS lists.
 
Old 09-06-2014, 04:42 PM   #3
ratotopi
Member
 
Registered: Dec 2011
Posts: 114

Original Poster
Rep: Reputation: 6
Thank you wpeckham for your input so are you suggesting to do the chroot for the vsftp and make it same like sftp chroot ? I am using OpenSSH and vsftp . I did setup sftp first but when i setup the vsftp it didnt work as vsftp didnt see user /sftp directory so i had to make changes
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
ftp or sftp earthy Linux - Software 2 02-12-2011 12:22 PM
how to create sftp user only in red hat 4 not ftp user ..only sftp user princeu28 Linux - Newbie 1 10-14-2008 09:10 AM
FTP and SFTP christopher_c Linux - Newbie 2 08-21-2008 12:07 AM
how to turn off ftp/sftp? Tarps87 Linux - Newbie 5 09-28-2007 12:51 AM
Using SFTP instead of FTP cliffyman Linux - Software 0 01-19-2003 11:41 AM


All times are GMT -5. The time now is 05:35 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration