Re: [Vserver] sshd and ptys

From: Herbert Poetzl <herbert_at_13thfloor.at>
Date: Thu 06 Oct 2005 - 01:29:22 BST
Message-ID: <20051006002922.GA27042@MAIL.13thfloor.at>

On Wed, Oct 05, 2005 at 01:05:27PM +0100, Jim Wight wrote:
> I'm returning to VServer after being away from it for over a year. One
> thing that worked previously and isn't working for me now is remotely
> logging in via ssh. I see the following in /var/log/messages:
>
> sshd[11932]: error: openpty: Permission denied
> sshd[11932]: error: session_pty_req: session 0 alloc failed
>
> I can reproduce the problem with a simple program that calls openpty.
> The output from strace'ing it contains:
>
> open("/dev/ptmx", O_RDWR) = 3

ptmx is here and assigns a pts ...

> statfs("/dev/pts", {f_type="DEVPTS_SUPER_MAGIC", f_bsize=4096, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0
> ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
> ioctl(3, TIOCGPTN, [1]) = 0
> stat64("/dev/pts/1", {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 1), ...}) = 0
> statfs("/dev/pts/1", {f_type="DEVPTS_SUPER_MAGIC", f_bsize=4096, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0
> ioctl(3, TIOCSPTLCK, [0]) = 0
> ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
> ioctl(3, TIOCGPTN, [1]) = 0
> stat64("/dev/pts/1", {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 1), ...}) = 0

pts/1 was assigned and is available ...

> open("/dev/pts/1", O_RDWR|O_NOCTTY) = -1 EACCES (Permission denied)

you got no permission for pts/1 ...

> Inside the vserver, /dev looks like this:
>
> # ls -l /dev
> total 0
> crw-rw-rw- 1 root root 1, 7 Oct 3 08:15 full
> srw-rw-rw- 1 root root 0 Oct 5 11:52 log
> crw-rw-rw- 1 root root 1, 3 Oct 3 08:15 null
> crw-rw-rw- 1 root root 5, 2 Oct 3 08:16 ptmx
> drwxr-xr-x 2 root root 0 Oct 3 15:36 pts

we do not see the pts/1 permissions here, but
probably cat /proc/mounts can tell us more ...

> crw-r--r-- 1 root root 1, 8 Oct 3 08:16 random
> crw-rw-rw- 1 root root 5, 0 Oct 3 08:16 tty
> crw-r--r-- 1 root root 1, 9 Oct 3 08:16 urandom
> crw-rw-rw- 1 root root 1, 5 Oct 3 08:17 zero
>
> What have I missed?

I'd assume, that your setup has restricted
permissions on the devpts mounted inside the guest
so that only a certain group (tty?) can access
them .. either changing the default permissions or
giving that group to the ssh user (ssh?) should
help here ...

> I am using kernel 2.6.12.5 with patch-2.6.12.4-vs2.0 and
> util-server-0.30.208. The host's filesystem is Fedora Core 2 and the
> vserver's FC4.

sounds good ...

HTH,
Herbert

> Jim
>
>
> _______________________________________________
> Vserver mailing list
> Vserver@list.linux-vserver.org
> http://list.linux-vserver.org/mailman/listinfo/vserver
_______________________________________________
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver
Received on Thu Oct 6 01:29:42 2005

[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Thu 06 Oct 2005 - 01:29:44 BST by hypermail 2.1.8