how to redirect in bash+crontab

how to redirect in bash+crontab

Oleg Goldshmidt pub at goldshmidt.org
Wed Jul 25 01:44:54 IDT 2012


Geoff Shang <geoff at QuiteLikely.com> writes:

> On Tue, 24 Jul 2012, Oleg Goldshmidt wrote:
>
>> I would be curious to know how recent versions of
>> SuSE/debian/ubuntu/*BSD/Mac OS X/whatever implement /dev/stderr.
>
> Debian 6.0 (current stable):
> lrwxrwxrwx 1 root root 15 Jun 18 16:37 /dev/stderr -> /proc/self/fd/2
> lrwx------ 1 root root 64 Jul 24 23:50 /proc/self/fd/2 -> /dev/tty5
> crw------- 1 root tty 4, 5 Jul 24 23:53 /dev/tty5
>
> I was on tty5 at the time.

As root or as a regular user?

Also, this is in an interactive session. How about crontab?
 
>
> Mac OS X 10.7 (Lion):
> lr-xr-xr-x  1 root  wheel  0 Jun 18 16:33 /dev/stderr -> fd/2
> crw--w----  1 geoff  tty   16,   0 Jul 24 23:50 /dev/fd/2

Aha! A symlink to /dev/fd/2... ;-)

>
> I was logged in over an SSH connection for this one, so decided to
> look at a Debian (Stable) box that I was also SSH'd into:
>
> lrwxrwxrwx 1 root root 15 Apr 28 07:46 /dev/stderr -> /proc/self/fd/2
> lrwx------ 1 mintfm mintfm 64 Jul 24 21:53 /proc/self/fd/2 -> /dev/pts/0
> crw--w---- 1 mintfm tty 136, 0 Jul 24 21:55 /dev/pts/0

What's the difference between this Debian stable and the first one?

At least the tty group permissions seem to be a bit clearer. On a
Fedora box I am logged into right now the first 7 ttys (0...6) belong to
root:root and are 600 (consoles?), while the rest belong to root:tty
and are 620. With pseudo-terminals it *seems* that remote sessions are
620 whle local are 600:

crw--w---- 1 oleg tty  136, 0 Jul 23 20:52 /dev/pts/0
crw------- 1 oleg tty  136, 1 Jul 25 01:33 /dev/pts/1

Thanks,

-- 
Oleg Goldshmidt | pub at goldshmidt.org



More information about the Linux-il mailing list