[Vserver] Hack idea how to create a pseudeo /dev/tty9 as root@guest ; )

From: Robert Michel <news_at_robertmichel.de>
Date: Fri 07 Jul 2006 - 23:38:54 BST
Message-ID: <20060707223854.GB15824@it1.de>

Salve Herbert!

> > But back to the topic "could root@guest use mknod".
> > Theoreticaly would it possible to add this feature
> > with a vmknode and a tool for root@host that guest
> > could create a block devices of their own without
> > harming other guests or the host itself
> > but it seems not to be a planed feature for vserver.
>
> well, what kind of 'devices' would you like to
> create inside a guest?

Well I like the "one task, one tool" philosophy,
or just the slogan "Devide et impera!" So I'm not
happy with the need to modificate asterisk scripts
or binary to run on a vserver.... remember in May
someone ask here on the list for the power to
create a fix terminal to use with perl.

But you are right, there are options for root@guest
to work around. My skripting skills are not so high
and my try would be better inside the asterisk scripts
for shure - but I'm looking for a solution that is
indepentend of the task - finaly it should be
a skript/demon that request a pseudo terminal
and link this to a fix /dev/tty$n ($n choosen by
root@guest).
The most perfect solution would be maybe, when
this pseudotty process take care that his "device"
exist and if not, that it is created again.

############################################
Howto creat a /dev/tty9 on a vserver without
the right to use mknode,
proposed by news@robertmichel.de 2006.07.07
############################################

Create two files:
   /dev/init.d/pseudo-tty9
   #!/usr/bin/expect -f
   # Some software likes to have an own terminal
   # but no function to request a pseudo terminal.
   # On some vservers exist no or not enough
   # tty devices, and root@guest does not have the
   # power to create some with mknode.
   # The idea of this script is to run a bash
   # as the user asterisk and detach it.
   #
   # expect "#" and "$" are part of the promt ;)2006
   # 2006.07.07 by news@RobertMichel.de

   spawn dtach -A /tmp/pseudoterm.socket.9 -e a bash
   expect "#" { send "/etc/init.d/pseudo-tty9-ln.sh\r" }
   expect "#" { send "su - asterisk\r" }
   expect "$" { send "a" }
   #EOF

And:
   /etc/init.d/pseudo-tty9-ln.sh
   #!/bin/bash

   ln -sf $(tty) /dev/tty9
   #EOF

and run then:
    update-rc.d -n pseudotty9 defaults
as well as:
    /dev/init.d/pseudo-tty9

############################################

I seems to work, but it is not smart to have
2 files, and no automaticaly restory in case
something crash.
- what would be smarter then run a bash?

I will not waste your time - Herbert,
I like to discuss this and ask for tips how
to make it better on a asterisk-users
and I think on debian-users mailinglist,too.

Maybe some others here on the list does have
ideas and tips ;)

But you can tell me how you would call
such a link to a pseudo terminal construction?

BTW a hack like pseudo-tt9 has one big
advantage compare to a new feature inside
the vserver-tools... it will run today on
all vservers -- I don't think that my provider
would update to a newer vserver version this
year... ;)

Have a nice weekend,
rob

_______________________________________________
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver
Received on Fri Jul 7 23:39:28 2006

[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Fri 07 Jul 2006 - 23:39:32 BST by hypermail 2.1.8