Accessing /dev/lpt0 in a Jail
Jasvinder S. Bahra
bbdl21548 at blueyonder.co.uk
Mon Feb 23 13:32:38 PST 2009
Paul,
Thanks for your help - it's much appreciated.
It looks like devfs rules are indeed what I need to play with. As i'm using
ezjail, it seems things are a little different. Instead of editing the
host's /etc/rc.conf file , and specifying the ruleset there, I had to edit
the /usr/local/etc/ezjail/pearl_domain_org file. In that file, there is an
entry that looks like this...
export jail_pearl_domain_org_devfs_ruleset="devfsrules_jail"
I changed that line to the following...
export jail_pearl_domain_org_devfs_ruleset="devfsrules_jail_pearl"
I then created (again, on the host) /etc/devfs.rules, and added the
following to it...
[devfsrules_jail_pearl=5]
add include $devfsrules_hide_all
add include $devfsrules_unhide_basic
add include $devfsrules_unhide_login
add path 'lpt*' unhide
These changes successfully made the lpt0 (and lpt0.ctl) device nodes visible
in the jail.
Unfortunately, i'm now having permission problems...
[root at pearl ~]# ls -al /dev/lpt*
crw------- 1 root wheel 0, 53 Feb 23 21:11 /dev/lpt0
crw------- 1 root wheel 0, 54 Feb 23 21:11 /dev/lpt0.ctl
I need the device nodes to have 0660 permissions and root:cups ownership. I
can easily make these changes using the chown and chmod tools, but the
changes do not survive a system reboot. Following some further research, I
understand I can make these changes occur automatically by adding some
entries in the jail's /etc/devfs.conf file...
own 'lpt*' root:cups
perm 'lpt*' 0660
Unfortunately, this didn't have any effect.
I also tried creating a device ruleset in the jail (i.e. creating a
/etc/devfs.rules file in the jail)...
[localrules=5]
add path 'lpt*' mode 0660 group cups
...and then applying that ruleset by adding the following to the jail's
/etc/rc.conf
devfs_system_ruleset="localrules"
However, yet again the changes had no effect.
Does anyone have any advice?
Thanks,
Jazz
----- Original Message -----
From: "Paul Procacci" <pprocacci at datapipe.com>
To: "Jasvinder S. Bahra" <bbdl21548 at blueyonder.co.uk>
Cc: <freebsd-questions at freebsd.org>
Sent: Monday, February 23, 2009 12:23 AM
Subject: Re: Accessing /dev/lpt0 in a Jail
> Jasvinder S. Bahra wrote:
>> Hi,
>>
>> I'm trying to setup CUPS (in a jail) using an old parallel port printer
>> on my server machine.
>>
>> I used ezjail to create a jail and then installed CUPS. I've got it up
>> and running, and I can access the administration website.
>>
>> However, as far as I can tell, the admin website doesn't seem to offer
>> any options regarding the parallel port. Following some research, I
>> believe I somehow needs to create a /dev/lpt0 entry, *in* the jail.
>>
>> Now, that entry exists on the jail's host system, but theres a limited
>> list of entries in the jail's /dev directory. If I do a "ls -al /dev"
>> (less quotes) in the jail, I get the following...
>>
>> [root at pearl cups]# ls -al /dev
>> total 0
>> dr-xr-xr-x 2 root wheel 512 Feb 22 19:04 fd
>> lrwxr-xr-x 1 root wheel 14 Feb 22 19:04 log -> ../var/run/log
>> crw-rw-rw- 1 root wheel 0, 16 Feb 22 19:22 null
>> crw-rw-rw- 1 root wheel 0, 122 Feb 22 19:28 ptyp0
>> crw-rw-rw- 1 root wheel 0, 8 Feb 22 19:04 random
>> lrwxr-xr-x 1 root wheel 4 Feb 22 19:04 stderr -> fd/2
>> lrwxr-xr-x 1 root wheel 4 Feb 22 19:04 stdin -> fd/0
>> lrwxr-xr-x 1 root wheel 4 Feb 22 19:04 stdout -> fd/1
>> crw--w---- 1 jazz tty 0, 123 Feb 22 19:28 ttyp0
>> lrwxr-xr-x 1 root wheel 6 Feb 22 19:04 urandom -> random
>> crw-rw-rw- 1 root wheel 0, 17 Feb 22 19:04 zero
>>
>> Does anyone know how I go about providing the jail with a link to lpt0?
>>
>> Thanks,
>>
>> Jazz
>>
>
> I've never used ezjail, as I usually setup jails myself. With that said,
> access to dev entries within jail are/can be controlled by devfs rules.
> The configuration for your rules is "administrator dependant". More
> specifically, you should find a line in your rc.conf that looks similar to
> the following:
>
> jail_devfs_ruleset="devfsrules_jail"
>
> This defines the ruleset used for your jails. Knowing this, you can now
> edit your rules file (/etc/devfs.rules) and add appropriate entries for
> your printer and associated devices.
>
> ~Paul
>
>
More information about the freebsd-questions
mailing list