LinuxQuestions.org
Help answer threads with 0 replies.
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 09-18-2009, 03:51 PM   #1
zaigon
LQ Newbie
 
Registered: Sep 2009
Posts: 7

Rep: Reputation: 0
How Can i Do This (Simple Question)


Hey!

I've made a user for my friend so he can have his files at my server.
Im running SFTP. When he has logged in he can go back to the root and watch all the folders i have on the server. How can i do so he only can view /var/www/myfriend/. And if he goes back he will like get an error where it says "Permission Denied!".

Thanks!
 
Old 09-18-2009, 04:09 PM   #2
MBybee
Member
 
Registered: Jan 2009
Location: wherever I can make a living
Distribution: OpenBSD / Debian / Ubuntu / Win7 / OpenVMS
Posts: 440

Rep: Reputation: 57
I think this covers what you're looking for:
http://www.minstrel.org.uk/papers/sftp/
http://ubuntuforums.org/showthread.php?t=128206

Basically, unless you've given him root access, you can block him to a specific file system/directory that you have chosen.
 
Old 09-18-2009, 04:21 PM   #3
zaigon
LQ Newbie
 
Registered: Sep 2009
Posts: 7

Original Poster
Rep: Reputation: 0
How can i block him? Isnt there any easier way?
 
Old 09-18-2009, 04:51 PM   #4
zaigon
LQ Newbie
 
Registered: Sep 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Anyone? Notice that i also want me to have root access, is that possible?
 
Old 09-18-2009, 05:05 PM   #5
MBybee
Member
 
Registered: Jan 2009
Location: wherever I can make a living
Distribution: OpenBSD / Debian / Ubuntu / Win7 / OpenVMS
Posts: 440

Rep: Reputation: 57
Quote:
Originally Posted by zaigon View Post
How can i block him? Isnt there any easier way?
Depending on the distro you're running (let's assume debian for the moment) you can also use this tutorial that makes it pretty simple:
http://tusforyou.com/chrooted-sshsft...-debian-lenny/

I'll summarize here:
1) sudo apt-get install ssh openssh-server
2) sudo vi /etc/ssh/sshd_config
3) Validate this line exists: Subsystem sftp /usr/lib/openssh/sftp-server
4) Add this at the very end for each user (or set up a group and add that)
Code:
Match User username
    ChrootDirectory /home
    AllowTCPForwarding no
    X11Forwarding no
    ForceCommand /usr/lib/openssh/sftp-server
5) sudo /etc/init.d/ssh restart
6) chmod 700 /home/username

Now, if you want it to be some other directory, just set that as the users home directory and modify accordingly. There is also a tutorial on his site for Ubuntu if you're running that.

The key you're looking for is what's called 'chroot' or 'jails', so if you look for 'chroot sftp distro' you'll probably find what you're looking for. Chroot is the term for setting a specific directory as 'root' (or /) for a specific user/group/process. It prevents them from moving any higher up the tree, so if you set up the shared filesystem as /shared/sftp/public and chroot the sftp process to /shared/sftp, they could see everything in public, nothing in /shared, and any files or directories under sftp.

Let me know if this works for you.

Last edited by MBybee; 09-18-2009 at 05:06 PM. Reason: grammar issues
 
  


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
Two things: (Probably Simple) Grub question, and a gDesklets question Wilffo Linux - Software 3 05-20-2006 01:33 PM
Ubuntu Fluxbox simple question, simple answer? generallimptoes Linux - Software 3 09-26-2005 02:03 PM
Installing Programs - A simple question from my simple mind jmp875 Linux - Newbie 6 02-18-2004 09:03 PM
Simple Question Task Linux - Software 7 07-16-2003 10:03 AM
simple question seeking simple answer enzo250gto Linux - Newbie 1 10-27-2001 04:08 AM

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

All times are GMT -5. The time now is 10:22 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