LinuxQuestions.org
Visit Jeremy's Blog.
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 12-15-2008, 01:22 AM   #1
crispyleif
Member
 
Registered: Mar 2005
Location: Norway, by the coast
Distribution: Debian and the likes
Posts: 190

Rep: Reputation: 31
SSH config for SFTP


I have a home server that I ssh into when needed. If I need graphics I start vnc and tunnel it over ssh. So I'm good. Anyway, some relatives have asked very kindly if I can put some certain family pictures on the net for them to download.
I don't want to do regular ftp, so I've been trying ftps (with vsftpd) but it gives me firewall grudges.

So, I started to think about making a directory shared over ssh using only password login (no keys)- something they could reach via winscp for instance.

What I want to accomplish is a SSH config that doesn't change my current ability to login to MY account (I'm using only keys), but grants user "relative" access to one directory, NO shell access (chrooted?), and preferrably forces the connection to be sftp rather than scp. phuh.



All thoughts welcome.
 
Old 12-15-2008, 02:01 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well i think you will need to chroot for the directory side, and define a given users shell for nologin to prevent shell logins. http://www.debian-administration.org/articles/590
 
Old 12-16-2008, 03:46 AM   #3
crispyleif
Member
 
Registered: Mar 2005
Location: Norway, by the coast
Distribution: Debian and the likes
Posts: 190

Original Poster
Rep: Reputation: 31
Thanks for the much informative link. This partwise solved it for me.
By adding "PasswordAuthentication yes" to the config I can no login as myself using keys only, and users in group sftponly can login to their chrooted home directory with their password. No extra needed (rssh, libs, etc..).

What remains is to firce the connection to be sftp rather than scp, and make sure they can access files with a client, but no shell.
I tried setting shell to /bin/false but then I got access denied. I guess ssh need shell access to do sftp.. so I'm stuck there. But its going forth..

In case someone is in the same pit, here's teh end of /etc/ssh/sshd_config (this is a Gentoo system):

# override default of no subsystems
Subsystem sftp internal-sftp

Match group sftponly
ChrootDirectory /home/%u
ForceCommand internal-sftp
AllowTCPForwarding no
X11Forwarding no
PubkeyAuthentication no
PasswordAuthentication yes
 
Old 12-17-2008, 07:06 AM   #4
pnorten462
LQ Newbie
 
Registered: Nov 2008
Posts: 6

Rep: Reputation: 0
Re : SSH config for SFTP

Hi friend,
On the SFTP Server page of the SSH Configuration utility you can configure the settings for secure file transfer protocol (SFTP). You can restrict regular users to have access only to specified directories, define their home directory and specify the events that are collected in the event log. With the Accessible directories feature you can define virtual directories for the users, and restrict them to have access only to those directories.
 
Old 12-17-2008, 07:08 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
what utility would that be??
 
Old 12-17-2008, 09:48 AM   #6
crispyleif
Member
 
Registered: Mar 2005
Location: Norway, by the coast
Distribution: Debian and the likes
Posts: 190

Original Poster
Rep: Reputation: 31
Indeed, do tell!

EDIT::The thing in your signature maybe ? Not good adverticing speaking about it that way .. now I know I can NEVER let myself try that program (should I for some reason feel the need)..

If no, please disregard the above.

Last edited by crispyleif; 12-17-2008 at 09:49 AM.
 
Old 12-17-2008, 07:40 PM   #7
javaroast
Member
 
Registered: Apr 2005
Posts: 131

Rep: Reputation: 19
I've used rssh in the past to do exactly what you are talking about. It allows sftp logins but no shell account. Use it in combination with a Chroot jail and it makes a pretty good sftp solution.

http://sourceforge.net/projects/rssh/

And here's an article that I found that takes you through the setup\
http://www.cyberciti.biz/tips/rhel-c...ssh-shell.html
 
Old 12-18-2008, 07:07 AM   #8
crispyleif
Member
 
Registered: Mar 2005
Location: Norway, by the coast
Distribution: Debian and the likes
Posts: 190

Original Poster
Rep: Reputation: 31
That was the first I looked into, but I thought rssh was a restricted shell allowing only scp and sftp commands ?

That + chroot is of course right on, but I have to say the openssh chrootcommand is neat.

Thanks for telling anyway.
 
  


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 and ssh kehkok Linux - Networking 4 09-20-2006 02:53 PM
SFTP and SSH XaViaR Linux - Security 5 07-20-2005 10:18 AM
What is the config file for sftp-server? cthulueldergod Linux - Networking 1 08-30-2004 09:42 PM
SSH - where are scp and sftp satimis Linux - Networking 2 11-15-2003 10:27 AM
ssh and sftp help Rex_chaos Linux - Networking 8 03-17-2003 08:12 PM

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

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