SSH chroot jail problems


 
Thread Tools Search this Thread
Operating Systems Linux Debian SSH chroot jail problems
# 1  
Old 04-14-2010
Question SSH chroot jail problems

Firstly Hi everyone Smilie

I setup SFTP and SSH jail using this tutorial:
http://www.howtoforge.com/chrooted-ssh-sftp-tutorial-debian-lenny

SFTP jail works however now when I try to SSH it accepts my password and then just goes to a blank screen. Type any command and the shell session is closed (and putty closes) without error.


I've restarted openssh many times and also the server, just cant get this working!



I can provide the debug for the failed and also a working SSH into the box if you need, just ask.


Server:
Debian 5.0.4
OpenSSH_5.1p1


sshd_config:
Subsystem sftp internal-sftp

UseLogin yes

Match user tom
ChrootDirectory /home/%u
ForceCommand internal-sftp

AllowTcpForwarding no

Also tried:

ChrootDirectory /home/tom


Tried with and without:
X11Forwarding no

Tried:

Subsystem sftp /usr/lib/openssh/sftp-server
ForceCommand /usr/lib/openssh/sftp-server

Permissions:
/home/tom has owner root chmod 755
All files and folders below this are chmod 755 and owner tom

Passwd file:
root:x:0:0:root:/root:/bin/bash
tom:x:1003:1004:Tom,,,:/home/tom:/bin/bash


Any ideas anyone?
# 2  
Old 04-14-2010
Read up on chroot. As soon as a process changes it's root directory, it can't access the files outside anymore. Shell, utilities, password file, ... are out of reach (invisible even). You'll have to set up a minimal environment yourself inside the chroot, mirroring that of a real system.
# 3  
Old 04-14-2010
In the tutorial it says to use this script to set that up:

fuschlberger.net - Howto Setup a chroot-jail for ssh/scp with Linux

I ran that for the user tom, the passwd file, bash and various other stuff has been placed inside /home/tom
# 4  
Old 04-14-2010
You also have to remove ForceCommand internal-sftp if you want to use ssh.
# 5  
Old 04-14-2010
It worked!!!
I knew it would be something simple..

However now I'm not jailed.. But I'll try to work this out on my own first.

Thanks very much! Smilie

---------- Post updated at 04:51 PM ---------- Previous update was at 04:04 PM ----------

ok fixed that too

all i needed was
UseLogin no

Smilie
# 6  
Old 08-21-2010
Hi Pokey


Im having same problems for long..

when it comes to su - user

i get /bin/su : incorrect password

what u mean by setting

userLogin No

where must i specify that

Im using suseLinux 10

Thanks
# 7  
Old 09-08-2010
chroot issues

hi there people...

i cant seem to get past this "/bin/su : incorrect password" either... ive run the script as prescribed above, but no bananas... im using redhat btw if that counts for anything...and im sure the password is correct..

any help from people who know ??

please.

many thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Ssh-keygen problems

For some reason, when I try copying my public key to the server, despite it showing as being successful: rob@linux044:~$ ssh-copy-id -i /home/rob/Work/Keys/keys.txt.pub !@#$%.com /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/rob/Work/Keys/keys.txt.pub"... (7 Replies)
Discussion started by: Circuits
7 Replies

2. Solaris

SSH/RSAAuthentication Problems

I'm attempting to setup RSA Authentication for a particular user on two servers. A script runs via crontab, logs into one server and transfers data from the server1 to server2. Another script via cron, runs on server2, connects to server 1 and transfers data to it. However, I'm having issues... (3 Replies)
Discussion started by: Nvizn
3 Replies

3. Red Hat

sftp jail chroot env setup

Hi I need a specific user to be able to sftp to a server and get files from a specific location. The location is not the users home dir, i don't want the user to be able to view anything else apart from the files in that area. e.g ftp file are is - /logging/phplogs e.g user home is... (1 Reply)
Discussion started by: duckeggs01
1 Replies

4. UNIX for Advanced & Expert Users

ssh jail user

I have a developer that needs ssh access to a server to get to a specific directory. I want to restrict them to that directory. I've tried to set their shell as rksh which does jail them but only if they are using ssh from another unix system. If they are using putty or winscp they can still... (2 Replies)
Discussion started by: toor13
2 Replies

5. Solaris

SSH & SFTP Chroot

Hello all, does anybody knows a procedure to enable an chroot for users using ssh and sftp ? Thanks (1 Reply)
Discussion started by: celord
1 Replies

6. UNIX for Advanced & Expert Users

Chroot jail environment puzzle

I have a simple sandbox program which runs a command as user "nobody" in a chroot jail. It sets resource limits with setrlimit, changes the user id with setuid, changes the root dir with chroot, and then calls exec to execute the command given as command line parameters. It is of course a... (8 Replies)
Discussion started by: john.english
8 Replies

7. UNIX for Advanced & Expert Users

SFTP Jail With Sun SSH Not OpenSSH

Hi all, I have a Solaris 10 server with SUN_SSH_1.1 installed. I want to restrict a user via SFTP to only be able to access one directory. I've written a little script in .profile which works perfectly for an ssh login but it appears sftp doesn't read the .profile file so it doesn't work. ... (2 Replies)
Discussion started by: Donkey25
2 Replies

8. UNIX for Dummies Questions & Answers

How to start a chroot jail?

I was reading an article on how it is very important to setup a chroot jail to run bind. I can follow what the article says but one thing I am unclear about is now on system boot the BIND process in the chroot jail will start since it the owner will no longer be root but some other user. Can... (1 Reply)
Discussion started by: mojoman
1 Replies

9. UNIX for Advanced & Expert Users

SSH problems

I am trying to ssh into a remote sun server, however I get X11 forwarding error. I have checked sshd_config file and X11 forwarding is enabled. Also xhost command doesnt give any output, it doesnt even return the prompt.I have to Ctrl C out of the situation. any suggestions anyone?? (1 Reply)
Discussion started by: ysk
1 Replies

10. News, Links, Events and Announcements

More SSH Problems.....

See: http://www.cert.org/advisories/CA-2002-36.html and http://www.rapid7.com/News/pr021216-ssh.html (1 Reply)
Discussion started by: Neo
1 Replies
Login or Register to Ask a Question