Mailing List Archive

problem with setting up ssh chroot account
Hello -

I am trying to set up a ssh chroot account on a Red Hat
Enterprise Linux 5 server. I have my jail set up and have copied over
a selection of commands and their libraries. I have also created a /
dev and some devices. As part of that, I had to create a /dev/pts
directory to handle the terminals.

However, when I try to connect as the chrooted user, I get the
following error:

error: /dev/pts/0: No such file or directory

Does anyone know how to solve this problem?

Garey Mills
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: problem with setting up ssh chroot account [ In reply to ]
garey <garey.mills@gmail.com> writes:
> I am trying to set up a ssh chroot account on a Red Hat Enterprise
> Linux 5 server. I have my jail set up and have copied over a selection
> of commands and their libraries. I have also created a / dev and some
> devices. As part of that, I had to create a /dev/pts directory to
> handle the terminals.
>
> However, when I try to connect as the chrooted user, I get the
> following error:
>
> error: /dev/pts/0: No such file or directory
>
> Does anyone know how to solve this problem?

/dev/pts is not a regular directory, it's a mountpoint for the synthetic
devpts filesystem. You need to mount a devpts instance inside the
chroot:

# mkdir /chroot/dev/pts
# mount -t devpts devpts /chroot/dev/pts

DES
--
Dag-Erling Smørgrav - des@des.no
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: problem with setting up ssh chroot account [ In reply to ]
Dag-Erling -

Thanks for the response. Definitely changed the error message. Now I'm
getting

Mar 27 11:34:52 dlab-gis sshd[11121]: error: open /dev/tty
failed - could not set controlling tty: Permission denied

Any thoughts?

Garey Mills


On Tue, Mar 27, 2012 at 10:46 AM, Dag-Erling Smørgrav <des@des.no> wrote:

> garey <garey.mills@gmail.com> writes:
> > I am trying to set up a ssh chroot account on a Red Hat Enterprise
> > Linux 5 server. I have my jail set up and have copied over a selection
> > of commands and their libraries. I have also created a / dev and some
> > devices. As part of that, I had to create a /dev/pts directory to
> > handle the terminals.
> >
> > However, when I try to connect as the chrooted user, I get the
> > following error:
> >
> > error: /dev/pts/0: No such file or directory
> >
> > Does anyone know how to solve this problem?
>
> /dev/pts is not a regular directory, it's a mountpoint for the synthetic
> devpts filesystem. You need to mount a devpts instance inside the
> chroot:
>
> # mkdir /chroot/dev/pts
> # mount -t devpts devpts /chroot/dev/pts
>
> DES
> --
> Dag-Erling Smørgrav - des@des.no
>



--
The brain is not where you think.
Me
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: problem with setting up ssh chroot account [ In reply to ]
On 27/03/12 19:53, Garey Mills wrote:
> Dag-Erling -
>
> Thanks for the response. Definitely changed the error message. Now I'm
> getting
>
> Mar 27 11:34:52 dlab-gis sshd[11121]: error: open /dev/tty
> failed - could not set controlling tty: Permission denied
>
> Any thoughts?
>
> Garey Mills
Well, what are the permissions of the /dev/tty device inside the chroot?
Is it indeed a character device with major number 5 and minor 0?

It is supposed to link the process with its controlling terminal.

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: problem with setting up ssh chroot account [ In reply to ]
On Tue, Mar 27, 2012 at 1:28 PM, Ángel González <keisial@gmail.com> wrote:

> On 27/03/12 19:53, Garey Mills wrote:
> > Dag-Erling -
> >
> > Thanks for the response. Definitely changed the error message. Now
> I'm
> > getting
> >
> > Mar 27 11:34:52 dlab-gis sshd[11121]: error: open /dev/tty
> > failed - could not set controlling tty: Permission denied
> >
> > Any thoughts?
> >
> > Garey Mills
> Well, what are the permissions of the /dev/tty device inside the chroot?
> Is it indeed a character device with major number 5 and minor 0?
>
> It is supposed to link the process with its controlling terminal.
>
>
crw-rw-rw-. 1 root root 5, 0 Mar 19 14:29 tty

--
The brain is not where you think.
Me
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: problem with setting up ssh chroot account [ In reply to ]
To keep the conversation going, here are listings of my chroot directory's
dev and dev/pts directories and the listing of the OS's /dev/pts directory

[root@dlab-gis dev]# ls -l
total 0
crw-rw-rw-. 1 root root 1, 3 Mar 19 14:28 null
drwxr-xr-x. 2 root root 0 Aug 17 2011 pts
crw-rw-rw-. 1 root root 5, 0 Mar 19 14:29 tty
crw-r--r--. 1 root root 1, 9 Mar 19 14:28 urandom
crw-rw-rw-. 1 root root 1, 5 Mar 19 14:29 zero
[root@dlab-gis dev]# cd pts
[root@dlab-gis pts]# ls -l
total 0
crw--w----. 1 gmills tty 136, 0 Mar 27 16:44 0
c---------. 1 root root 5, 2 Aug 17 2011 ptmx
[root@dlab-gis pts]# ls /dev/pts
0 ptmx
[root@dlab-gis pts]# ls -l /dev/pts
total 0
crw--w----. 1 gmills tty 136, 0 Mar 27 16:45 0
c---------. 1 root root 5, 2 Aug 17 2011 ptmx

The devpts partition is mounted at /dev/pts and /home/jail/dev/pts. Perhaps
this is the problem?

Garey Mills



On Tue, Mar 27, 2012 at 1:41 PM, Garey Mills <garey.mills@gmail.com> wrote:

>
>
> On Tue, Mar 27, 2012 at 1:28 PM, Ángel González <keisial@gmail.com> wrote:
>
>> On 27/03/12 19:53, Garey Mills wrote:
>> > Dag-Erling -
>> >
>> > Thanks for the response. Definitely changed the error message. Now
>> I'm
>> > getting
>> >
>> > Mar 27 11:34:52 dlab-gis sshd[11121]: error: open /dev/tty
>> > failed - could not set controlling tty: Permission denied
>> >
>> > Any thoughts?
>> >
>> > Garey Mills
>> Well, what are the permissions of the /dev/tty device inside the chroot?
>> Is it indeed a character device with major number 5 and minor 0?
>>
>> It is supposed to link the process with its controlling terminal.
>>
>>
> crw-rw-rw-. 1 root root 5, 0 Mar 19 14:29 tty
>
>
> --
> The brain is not where you think.
> Me
>
>


--
The brain is not where you think.
Me
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev