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-29-2016, 11:01 AM   #1
navachaitanya
LQ Newbie
 
Registered: May 2012
Posts: 2

Rep: Reputation: Disabled
Restrict SFTP user to home directory


Hi All

I need help in restricting FTP user to given home Directory for a user

For example when I create a ftp user with below command

useradd -d /usr/share/testuser testuser
user will be created with home directory as "/usr/share/testuser"

so user can only access /usr/share/testuser when connected to ftp

they should not be accessible up level directory as in attached screenshot

https://i.imgsafe.org/b7db4899a5.jpg

can anyone help me on this please

I am using vsftpd

Please anyone helpme...
Thanks in Advance
 
Old 07-29-2016, 11:05 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,675

Rep: Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970
Quote:
Originally Posted by navachaitanya View Post
Hi All
I need help in restricting FTP user to given home Directory for a user For example when I create a ftp user with below command

useradd -d /usr/share/testuser testuser
user will be created with home directory as "/usr/share/testuser"

so user can only access /usr/share/testuser when connected to ftp they should not be accessible up level directory as in attached screenshot

https://i.imgsafe.org/b7db4899a5.jpg

can anyone help me on this please I am using vsftpd
Would help if we knew what version/distro of Linux you're using, but you do realize you're asking two different questions, right? FTP IS NOT SFTP. SFTP runs over SSH, and *IS NOT* attached to vsftpd at all. The term for what you're asking is called "chroot" (or "change root"). While vsftpd may be set to do this, SFTP needs configuration in the SSH configs.

https://www.howtoforge.com/restricti...debian-squeeze

The tutorial is for Debian, but should work on other distros too. The settings are the same.
 
Old 07-29-2016, 11:39 AM   #3
navachaitanya
LQ Newbie
 
Registered: May 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks TB0ne
I am using Centos 6.5, yeah

yes,I am using ftp using vsftpd,
can you please explain me both if possible,for both ftp and sftp
I am very thankful of you tell me both
Thanks in advance
 
Old 07-29-2016, 12:00 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,675

Rep: Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970
Quote:
Originally Posted by navachaitanya View Post
Thanks TB0ne
I am using Centos 6.5, yeah

yes,I am using ftp using vsftpd, can you please explain me both if possible,for both ftp and sftp I am very thankful of you tell me both Thanks in advance
Sorry, but no. I have told you the terminology, and handed you a tutorial on how to do this for SFTP. There is absolutely no reason you cannot put "how to configure chroot in vsftpd" into Google, and look up a tutorial for yourself. You can even just look at the man page for vsftpd.conf, or even just OPEN that file, and look for that term.

We are happy to help with SPECIFIC questions, but we aren't going to type up tutorials or look things up for you.
 
  


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
sftp user jail to a different home directory hectortool Red Hat 2 03-07-2015 03:06 AM
Restrict Users to their Home DIrectory ghandizzle8 Linux - Newbie 6 02-08-2012 04:18 PM
need to restrict users access to own home directory afgs_uk Linux - Security 2 11-08-2006 11:18 AM
How restrict to home directory in telnet session cuencano Linux - Security 3 06-14-2005 05:01 PM
restrict user to home directory at logon pragti Linux - Security 6 02-27-2004 08:00 AM

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

All times are GMT -5. The time now is 06:07 PM.

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