# scp/sftp in a chrooted environment [SOLVED]

## -freddy-

Hi all,

I've created a chrooted environment for a user with Jail in "/home". I can login to the chroot with the bash shell but when I run scp or sftp command I have this error message   :Sad:   :

```
-jail-3.00$ scp

Couldn't open /dev/null: Permission denied
```

```
ls -al /home/dev

total 12

drwxr-xr-x  3 root     root 4096 aoû 30 15:04 .

drwxr-xr-x 14 root     root 4096 aoû 30 15:09 ..

crw-r--r--  1 root     root 1, 3 aoû 30 15:04 null

drwxr-xr-x  2 root     root 4096 aoû 30 14:20 pts

crw--w----  1 testuser tty  5, 0 aoû 30 14:01 tty

cr--r--r--  1 root     root 1, 9 aoû 30 14:00 urandom

crw-r--r--  1 root     root 1, 5 aoû 30 15:04 zero
```

any idea?Last edited by -freddy- on Mon Sep 04, 2006 9:31 am; edited 1 time in total

----------

## taz

It looks like your user's shell is set to /dev/null.  Make sure that it's set to /bin/zsh (or bash, tcsh, etc...).

----------

## -freddy-

 *taz wrote:*   

> It looks like your user's shell is set to /dev/null.  Make sure that it's set to /bin/zsh (or bash, tcsh, etc...).

 

In the "/etc/passwd" file, the shell for my testuser is /usr/bin/jail

```
testuser:x:1002:100:,,,:/home:/usr/bin/jail
```

In the "chrooted" passwd file the shell is /bin/bash

```
testuser:x:1002:100:,,,:/testuser:/bin/bash
```

I tried to connect to my server with sftp command but I have this message : "Connection Closed"   :Confused: 

----------

## -freddy-

up   :Sad: 

----------

## -freddy-

I solved it!

Just remove nodev flag in /etc/fstab   :Laughing: 

----------

