Re: Which user env. variable tell me that it is in "su - " mode ?

2009-03-03 Thread Ivan Warren

John Summerfield wrote:

In contrast, the tty command returns an actual device name when possible.


Talking about tty.. (labeit in a slightly different context for the word
'tty' !)

There is one big diff between a login & a 'su -' :

You don't gain ownership of /dev/tty on 'su -'.. This is some effect
when you're going from root to a less privileged user..

And it does affect *some* programs (like screen)..

--Ivan



--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


smime.p7s
Description: S/MIME Cryptographic Signature


Re: Which user env. variable tell me that it is in "su - " mode ?

2009-03-03 Thread John Summerfield

Marco Bosisio wrote:

Hi John,
the   'profile.local'   launch  'script _xxx'  and  it checks "$TERM" 
:  only if   set  to  ' XTERM'it  continue. 
(I prefer  that   "profile.local"  remains simple and  only contain 
the call to  'script_xxx'  with complex code) 


Whatever TERM is set to, it's not a defined way of finding whether you 
have a terminal at all.


Did you find this one?
08:21 [sum...@bobtail ~]$ echo $TERM
screen
08:21 [sum...@bobtail ~]$

It's used to discover what escape sequences to use to perform such 
functions as position cursor, erase parts of the screen, set colours and 
so on.


"dumb" is an arbitrary name used to describe an 80-column terminal with 
not much functionality at all.


If you have a look at /etc/termcap you will see a lot of names, and if 
you wished you could add some of your own.


In contrast, the tty command returns an actual device name when possible.




1) This is the secondary console where  root  is always active  of  a 
Linux/zVM :


UIDPID  PPID  C STIME TTY  TIME CMD 
root  1342 1  1342  1342  0 Jan28 ttyS000:00:00 /bin/sh 
--login 

And   'dumb'is  the content  of   "$TERM"of   SuSE SLES8 - SLES9 - 
SLES10,   REDHAT AS 4   :
 
echo $TERM 
dumb 
lx1iard0:/ #


In this case the 'script_xxx'   cannot   be  executed.


2)  When an user  is  logged  via  SSH/Putty'xterm'  is the content of 
  "$TERM"  : 


lx1iard0:~ # echo $TERM
xterm

In this case the 'profile.local'   launch  the  'script_xxx'  and  it  can 
 continue. 



3)  When I  use  ' su - '   I would like  that  the   'profile.local' 
launch  'script_xxx'   but   it ( 'script_xxx')   has to check  something 
(???) and  I can chose if  terminate or take another way. 


Ciaoo

Cordiali saluti  / Best regards
 
Marco Bosisio IBM Italia S.p.A






John Summerfield  
Sent by: Linux on 390 Port 

03/03/2009 13.09
Please respond to
Linux on 390 Port 


To
LINUX-390@VM.MARIST.EDU
cc

Subject
Re: Which user env. variable tell me that it is in  "su - "   mode ?






Marco Bosisio wrote:

Hi,
  do you know  wich user  environment variable I have to test (executing
a bash script)   to know  when  I am  in   "su -"   (switch user mode) ?


Reading variables provided  by  "env"  command   then testing   $TERM  I
am able to  know  if  not  a Linux terminal :


That probably isn't as useful as you think, TERM can have almost any 
value.

See man(1) tty


for what I think you want.

Also, to test whether you're root, man(1) id.
To test whether you can write a particular file,
test --help
eg
test -w /bin/bash

It's preferable to test for the relevant capability, you may have some
security software (eg selinux) that prevents even root from doing some
things.




--

Cheers
John

-- spambait
1...@coco.merseine.nu  z1...@coco.merseine.nu
-- Advice
http://webfoot.com/advice/email.top.php
http://www.catb.org/~esr/faqs/smart-questions.html
http://support.microsoft.com/kb/555375

You cannot reply off-list:-)

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or 
visit

http://www.marist.edu/htbin/wlvindex?LINUX-390



IBM Italia S.p.A.
Sede Legale: Circonvallazione Idroscalo - 20090 Segrate (MI) 
Cap. Soc. euro 400.001.359

C. F. e Reg. Imprese MI 01442240030 - Partita IVA 10914660153
Societ� soggetta all?attivit� di direzione e coordinamento di 
International Business Machines Corporation


(Salvo che sia diversamente indicato sopra / Unless stated otherwise 
above)


--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390




--

Cheers
John

-- spambait
1...@coco.merseine.nu  z1...@coco.merseine.nu
-- Advice
http://webfoot.com/advice/email.top.php
http://www.catb.org/~esr/faqs/smart-questions.html
http://support.microsoft.com/kb/555375

You cannot reply off-list:-)

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


RES: RES: SLES initial installation on IBM z890

2009-03-03 Thread Helio Mario Neves Pimentel de Oliveira
Mark,

'My' Linux is running ok.

Helio Mario - Brasil



-Mensagem original-
De: Linux on 390 Port [mailto:linux-...@vm.marist.edu] Em nome de Mark
Post
Enviada em: sábado, 28 de fevereiro de 2009 18:24
Para: LINUX-390@VM.MARIST.EDU
Assunto: Re: RES: SLES initial installation on IBM z890


>>> On 2/28/2009 at  4:17 PM, Helio Mario Neves Pimentel de Oliveira
 wrote: 
> Thks Mark,
> 
> First a correction: I*m working on the SLES 10 - S390 SP2. No, I don*t

> have z/VM. So, should I go through TAPE?

No, not tape.  You will need to have a network installation server.
That means, you will need to have a server, somewhere in your internal
network, that serves up the installation media via HTTP, FTP, or NFS.
It is preferable that this server be Linux or UNIX, not Windows.  This
implies that you will need a working TCP/IP connection, on the needed
port(s), from your mainframe to the installation server.  See
http://linuxvm.org/Present/SHARE111/S9233mp.pdf for other things to
consider.


Mark Post

--
For LINUX-390 subscribe / signoff / archive access instructions, send
email to lists...@vm.marist.edu with the message: INFO LINUX-390 or
visit http://www.marist.edu/htbin/wlvindex?LINUX-390

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Re: FCP at DRP

2009-03-03 Thread Mark Post
>>> On 3/2/2009 at  6:26 PM, Moeur Tim C  wrote: 
> Hello list,
> 
> I have a problem looking for a solution and I'm hoping that someone here
> might have some suggestions.
> 
> We have recently implemented FCP on our zLinux machines.  Our /boot
> directory is still 3390, but after the IPL some of the filesystem are
> FCP.   I've discovered that the /etc/zfcp.conf file will need to be
> different  when we boot the system here or when we boot it at our DR
> site.   I'm considering methods to quickly start the system with as
> little intervention as possible.   I'd rather avoid a three step DR
> process to IPL in single user, fix zfcp.conf, boot again.  Does anybody
> have some suggestions or recommendations for automating this? 

The main issue I see in trying to automate this would be ensuring that every 
time you go to the DR site, you get assigned the same FCP adapters, and the SAN 
storage so that the WWPN and LUNs don't change every time.  If that can't/won't 
be guaranteed then I think you're out of luck.  If it _can_ be guaranteed, then 
you really don't have to do much.  If you run the zfcp_??_configure routines, 
the udev rules will get updated, and the next time you run a test, it should 
just work.

Alternatives that I can imagine would only be feasible if you have z/VM and a 
rather small number of guests, since it would require updating a file on each 
guest's 191 disk to allow current information about that to be read during boot 
time.  One that would introduce a noticeable performance hit would be to have 
z/VM manage the disks via EDEV, and present them to the guests as minidisks.  
Then you only have to make changes in one place, z/VM.


Mark Post

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


resurrecting PGP

2009-03-03 Thread Richard Troth
Someone on my team had a bright idea that uses GPG.  Having used PGP
some years prior, I was excited to see this and was struck by a flood of
memories about "strong encryption".


After all this time, I dug up my PGP keys.  They're old enough that I
don't know how much I trust them, so I created new keys (with GPG
because I could get it as source code and for other reasons).  And this
week, I happily find myself at one of those conferences where friends
from far away are within handshake distance, so there is opportunity for
some key signing.  (Signing keys is something which should always be
done IN PERSON.)


If you happen to be at SHARE in Austin this week and have a GPG key and
want a signature, let me know.  I don't know all of the guerrilla key
mongers present, but have made my interest known and can perhaps connect
you with some.


Happy Trails, cowboys!


-- R;

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Re: Which user env. variable tell me that it is in "su - " mode ?

2009-03-03 Thread Erik N Johnson
Clearly, you want behaviour OTHER than what normally happens when
users call su -.  I would recommend writing a small alias or script to
let people issue INSTEAD of su - when you want this functionality.
You may want to examine the funtionality of env, a command which
allows you to create a clean execution environment and populate it
ground up with exactly the variables you want and nothing else.  Then
you can have whatever sort of artificial root environment to designate
the special status of having logged in as a luser and magically 'su'ed
to root.

Of course, this DOES mean that you'll have to send a memo around
explaining the new command everybody is supposed to use.  And that, in
turn, means that people will complain and do it wrong a whole bunch.
Of course, people who are given to whining and getting things wrong
are not high on my list of users to add to the wheel group...

Erik Johnson

On Tue, Mar 3, 2009 at 8:38 AM, Marco Bosisio  wrote:
> Hi John,
>    the   'profile.local'   launch  'script _xxx'  and  it checks "$TERM"
> :  only if   set  to  ' XTERM'    it  continue.
>    (I prefer  that   "profile.local"  remains simple and  only contain
> the call to  'script_xxx'  with complex code)
>
> 1) This is the secondary console where  root  is always active  of  a
> Linux/zVM     :
>
> UID        PID  PPID  C     STIME TTY          TIME CMD
> root      1342     1  1342  1342  0 Jan28 ttyS0    00:00:00 /bin/sh
> --login
>
> And   'dumb'    is  the content  of   "$TERM"    of   SuSE SLES8 - SLES9 -
> SLES10,   REDHAT AS 4   :
>
> echo $TERM
> dumb
> lx1iard0:/ #
>
> In this case the 'script_xxx'   cannot   be  executed.
>
>
> 2)  When an user  is  logged  via  SSH/Putty    'xterm'  is the content of
>  "$TERM"  :
>
> lx1iard0:~ # echo $TERM
> xterm
>
> In this case the 'profile.local'   launch  the  'script_xxx'  and  it  can
>  continue.
>
>
> 3)  When I  use  ' su - '   I would like  that  the   'profile.local'
> launch  'script_xxx'   but   it ( 'script_xxx')   has to check  something
> (???) and  I can chose if  terminate or take another way.
>
> Ciaoo
>
> Cordiali saluti  / Best regards
>
>        Marco Bosisio IBM Italia S.p.A
>
>
>
>
>
> John Summerfield 
> Sent by: Linux on 390 Port 
> 03/03/2009 13.09
> Please respond to
> Linux on 390 Port 
>
>
> To
> LINUX-390@VM.MARIST.EDU
> cc
>
> Subject
> Re: Which user env. variable tell me that it is in  "su - "   mode ?
>
>
>
>
>
>
> Marco Bosisio wrote:
>> Hi,
>>   do you know  wich user  environment variable I have to test (executing
>> a bash script)   to know  when  I am  in   "su -"   (switch user mode) ?
>>
>>
>> Reading variables provided  by  "env"  command   then testing   $TERM  I
>> am able to  know  if  not  a Linux terminal :
>
> That probably isn't as useful as you think, TERM can have almost any
> value.
> See man(1) tty
>
>
> for what I think you want.
>
> Also, to test whether you're root, man(1) id.
> To test whether you can write a particular file,
> test --help
> eg
> test -w /bin/bash
>
> It's preferable to test for the relevant capability, you may have some
> security software (eg selinux) that prevents even root from doing some
> things.
>
>
>
>
> --
>
> Cheers
> John
>
> -- spambait
> 1...@coco.merseine.nu  z1...@coco.merseine.nu
> -- Advice
> http://webfoot.com/advice/email.top.php
> http://www.catb.org/~esr/faqs/smart-questions.html
> http://support.microsoft.com/kb/555375
>
> You cannot reply off-list:-)
>
> --
> For LINUX-390 subscribe / signoff / archive access instructions,
> send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or
> visit
> http://www.marist.edu/htbin/wlvindex?LINUX-390
>
>
>
> IBM Italia S.p.A.
> Sede Legale: Circonvallazione Idroscalo - 20090 Segrate (MI)
> Cap. Soc. euro 400.001.359
> C. F. e Reg. Imprese MI 01442240030 - Partita IVA 10914660153
> Società soggetta all?attività di direzione e coordinamento di
> International Business Machines Corporation
>
> (Salvo che sia diversamente indicato sopra / Unless stated otherwise
> above)
>
> --
> For LINUX-390 subscribe / signoff / archive access instructions,
> send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
> http://www.marist.edu/htbin/wlvindex?LINUX-390
>

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Re: OpenSim on zLinux

2009-03-03 Thread David Boyes
On 3/3/09 9:10 AM, "Gary Detro"  wrote:
 
> Is anyone running OpenSim on zLinux?
> OpenSim provides the ability to host your own Second Life environment (3D).

Yes. Takes bloody forever to build, but operates just fine. You need a far
more modern Mono than the one in RHEL/SLES, though.

Before anyone laughes, it's a very elegant way to present multiple data
flows that have nothing to do with screwing around with Second Life. The
Second Life client happens to work with it, but there are lots of other
interesting things that can be done with it.

Some things I'm playing with: systems management with a walkthrough of the
actual data center (you can walk through a model of your data center and
look at the individual machines. Tap one, and it shows current status, tap
twice and you get historical trend data). I hope to get it pulling data from
WLM at some point (Donna? Are you out there?)

-- db
 

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Re: Which user env. variable tell me that it is in "su - " mode ?

2009-03-03 Thread Marco Bosisio
Hi John,
the   'profile.local'   launch  'script _xxx'  and  it checks "$TERM" 
:  only if   set  to  ' XTERM'it  continue. 
(I prefer  that   "profile.local"  remains simple and  only contain 
the call to  'script_xxx'  with complex code) 

1) This is the secondary console where  root  is always active  of  a 
Linux/zVM :

UIDPID  PPID  C STIME TTY  TIME CMD 
root  1342 1  1342  1342  0 Jan28 ttyS000:00:00 /bin/sh 
--login 

And   'dumb'is  the content  of   "$TERM"of   SuSE SLES8 - SLES9 - 
SLES10,   REDHAT AS 4   :
 
echo $TERM 
dumb 
lx1iard0:/ #

In this case the 'script_xxx'   cannot   be  executed.


2)  When an user  is  logged  via  SSH/Putty'xterm'  is the content of 
  "$TERM"  : 

lx1iard0:~ # echo $TERM
xterm

In this case the 'profile.local'   launch  the  'script_xxx'  and  it  can 
 continue. 


3)  When I  use  ' su - '   I would like  that  the   'profile.local' 
launch  'script_xxx'   but   it ( 'script_xxx')   has to check  something 
(???) and  I can chose if  terminate or take another way. 

Ciaoo

Cordiali saluti  / Best regards
 
Marco Bosisio IBM Italia S.p.A





John Summerfield  
Sent by: Linux on 390 Port 
03/03/2009 13.09
Please respond to
Linux on 390 Port 


To
LINUX-390@VM.MARIST.EDU
cc

Subject
Re: Which user env. variable tell me that it is in  "su - "   mode ?






Marco Bosisio wrote:
> Hi,
>   do you know  wich user  environment variable I have to test (executing
> a bash script)   to know  when  I am  in   "su -"   (switch user mode) ?
>
>
> Reading variables provided  by  "env"  command   then testing   $TERM  I
> am able to  know  if  not  a Linux terminal :

That probably isn't as useful as you think, TERM can have almost any 
value.
See man(1) tty


for what I think you want.

Also, to test whether you're root, man(1) id.
To test whether you can write a particular file,
test --help
eg
test -w /bin/bash

It's preferable to test for the relevant capability, you may have some
security software (eg selinux) that prevents even root from doing some
things.




--

Cheers
John

-- spambait
1...@coco.merseine.nu  z1...@coco.merseine.nu
-- Advice
http://webfoot.com/advice/email.top.php
http://www.catb.org/~esr/faqs/smart-questions.html
http://support.microsoft.com/kb/555375

You cannot reply off-list:-)

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or 
visit
http://www.marist.edu/htbin/wlvindex?LINUX-390



IBM Italia S.p.A.
Sede Legale: Circonvallazione Idroscalo - 20090 Segrate (MI) 
Cap. Soc. euro 400.001.359
C. F. e Reg. Imprese MI 01442240030 - Partita IVA 10914660153
Società soggetta all?attività di direzione e coordinamento di 
International Business Machines Corporation

(Salvo che sia diversamente indicato sopra / Unless stated otherwise 
above)

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


OpenSim on zLinux

2009-03-03 Thread Gary Detro
Is anyone running OpenSim on zLinux?


OpenSim provides the ability to host your own Second Life environment
(3D).

Thanks,
Detro


Senior IT Specialist
1177 S. Beltline Rd,  Coppell, TX 75019
Internal Mail Stop: 71-01-3001O
Phone: 469-549-8174 (t/l603)
Fax: 469-549-8149 (t/l 603)
de...@us.ibm.com
Global Solution Center (GSC)



<><>

Re: Kerridge on linux

2009-03-03 Thread Mark Post
>>> On 3/3/2009 at  1:18 AM, Calvin  wrote: 
> Hello all
> 
> 
> 
> Is there anyone who is running KERRIDGE software package on system z Linux?
> What are the pre-request for this package to run on system z Linux?

I've never even heard of it, so you might not get much in the way of answers.  
Just what is it?


Mark Post

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Re: Which user env. variable tell me that it is in "s u - " mode ?

2009-03-03 Thread Christian Borntraeger
Am Tuesday 03 March 2009 13:58:59 schrieb Marco Bosisio:
> I customized the profile.local and it launch a script_xxx at login.  When 
> use  'su - '   I would like that the new user does not  execute the 
> script_xxx again.

Ah, ok. 
The thing is, profile is for login shells. And with "-" you _explicitely ask_
su to open a login shell. If you dont want that, run su without the "-".

From man su:


DESCRIPTION
   Change the effective user id and group id to that of USER.

   -, -l, --login
  make the shell a login shell

Christian

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Re: Which user env. variable tell me that it is in "su - " mode ?

2009-03-03 Thread Christian Borntraeger
Am Tuesday 03 March 2009 11:10:46 schrieb Marco Bosisio:
> Hi,
>   do you know  wich user  environment variable I have to test  (executing
> a bash script)   to know  when  I am  in   "su -"   (switch user mode)   ?

Firstly, You should ask yourself why you need that information. If your script
behaves different in "su -" than a real root login, it is almost certainly
broken. Users expect that "su -" works like a real login.

You should check for any necessary capability instead.


Nevertheless,

In bash, something like
cat /proc/`cat /proc/$$/stat | cut -d " " -f 4`/cmdline

gives you the command line of the bash's parent process.

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Re: Which user env. variable tell me that it is in "s u - " mode ?

2009-03-03 Thread Marco Bosisio
Hi Hubert,
  your suggestion works fine  running for nested scripts,   I  created  3 
script   testa  ->  testb  ->  testc  like this  : 
 
lx1iard0:~ # cat  testa
#!/bin/bash
echo "testa => SHLVL="$SHLVL
sh /root/testb
exit


lx1iard0:~ # echo $SHLVL
1

lx1iard0:~ # sh testa
testa => SHLVL=2
--testb => SHLVL=3
testc => SHLVL=4


But the  variable  $SHLVL  is always  1   after  a  "su -  "  : 

it32...@lx1iard0:~> echo $SHLVL
1
it32...@lx1iard0:~> su -
Password:
lx1iard0:~ # echo $SHLVL
1
lx1iard0:~ #


I customized the profile.local and it launch a script_xxx at login.  When 
use  'su - '   I would like that the new user does not  execute the 
script_xxx again.


Cordiali saluti  / Best regards
 
Marco Bosisio IBM Italia S.p.A.







Hubert Kleinmanns  
Sent by: Linux on 390 Port 
03/03/2009 11.32
Please respond to
Linux on 390 Port 


To
LINUX-390@VM.MARIST.EDU
cc

Subject
Re: Which user env. variable tell me that it is in  "s u - "   mode ?






Hi Marco,

try:

echo $SHLVL

The value is incremented for each new sub shell - so it will be "1" for 
login shells (which you get with "su - ..."

Regards
Hubert


> -Ursprüngliche Nachricht-
> Von: "Marco Bosisio" 
> Gesendet: 03.03.09 11:12:04
> An: LINUX-390@VM.MARIST.EDU
> Betreff: Which user env. variable tell me that it is in  "su - "   mode 
?


> Hi,
>   do you know  wich user  environment variable I have to test (executing
> a bash script)   to know  when  I am  in   "su -"   (switch user mode) ?
> 
> 
> Reading variables provided  by  "env"  command   then testing   $TERM  I
> am able to  know  if  not  a Linux terminal :
> ..
> ...
> # We can only execute on a terminal SSH / Telnet ,   not  executed if
> secondary console Linux/zVM
> if [[ "$TERM" != "xterm" ]] ; then  exit
> fi
> ..
> 
> I would like to do the same  when the script  is executed  in a  user
> logged  in  "su -  "   mode...
> 
> Thanks in advance.
> 
> Cordiali saluti  / Best regards
> 
>  Marco BosisioIBM Italia S.p.A.
> 
> --
> For LINUX-390 subscribe / signoff / archive access instructions,
> send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or 
visit
> http://www.marist.edu/htbin/wlvindex?LINUX-390
> 

-- 
Hubert Kleinmanns
Beratung / Schulung / Projektleitung

Chairman der WG "WebSphere MQ and Business Integration" in der GSE, deutsche 
Region.

Tel.: +49 (0) 60 78 / 7 12 21
Fax: +49 (0) 60 78 / 7 12 25
Mobil: +49 (0) 178 / 6 97 22 54
Web: www.kleinmanns.eu
GSE: www.gsenet.de

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or 
visit
http://www.marist.edu/htbin/wlvindex?LINUX-390



IBM Italia S.p.A.
Sede Legale: Circonvallazione Idroscalo - 20090 Segrate (MI) 
Cap. Soc. euro 400.001.359
C. F. e Reg. Imprese MI 01442240030 - Partita IVA 10914660153
Società soggetta all?attività di direzione e coordinamento di 
International Business Machines Corporation

(Salvo che sia diversamente indicato sopra / Unless stated otherwise 
above)

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Re: Which user env. variable tell me that it is in "su - " mode ?

2009-03-03 Thread John Summerfield

Marco Bosisio wrote:

Hi,
  do you know  wich user  environment variable I have to test  (executing
a bash script)   to know  when  I am  in   "su -"   (switch user mode)   ?


Reading variables provided  by  "env"  command   then testing   $TERM  I
am able to  know  if  not  a Linux terminal :


That probably isn't as useful as you think, TERM can have almost any value.
See man(1) tty


for what I think you want.

Also, to test whether you're root, man(1) id.
To test whether you can write a particular file,
test --help
eg
test -w /bin/bash

It's preferable to test for the relevant capability, you may have some
security software (eg selinux) that prevents even root from doing some
things.




--

Cheers
John

-- spambait
1...@coco.merseine.nu  z1...@coco.merseine.nu
-- Advice
http://webfoot.com/advice/email.top.php
http://www.catb.org/~esr/faqs/smart-questions.html
http://support.microsoft.com/kb/555375

You cannot reply off-list:-)

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Re: Which user env. variable tell me that it is in "s u - " mode ?

2009-03-03 Thread John Summerfield

Hubert Kleinmanns wrote:

Hi Marco,

try:

echo $SHLVL

The value is incremented for each new sub shell - so it will be "1" for login shells 
(which you get with "su - ..."

and with sudo:
21:01 [sum...@bobtail ~]$ sudo bash -c set | grep SHLVL
SHLVL=1
21:02 [sum...@bobtail ~]$




--

Cheers
John

-- spambait
1...@coco.merseine.nu  z1...@coco.merseine.nu
-- Advice
http://webfoot.com/advice/email.top.php
http://www.catb.org/~esr/faqs/smart-questions.html
http://support.microsoft.com/kb/555375

You cannot reply off-list:-)

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Re: neat? bash stuff that I didn't know.

2009-03-03 Thread John Summerfield

Tom Simons wrote:

Is gawk available?  I've used the '|&' operator, but not on Linux-390.

http://www.gnu.org/software/gawk/manual/gawkinet/html_node/Gawk-Special-Files.html#Gawk-Special-Files

2.1 gawk's Networking Mechanisms

The �|&� operator introduced in gawk 3.1 for use in communicating with a
coprocess is described in Two-way Communications With Another
Process.

404




--

Cheers
John

-- spambait
1...@coco.merseine.nu  z1...@coco.merseine.nu
-- Advice
http://webfoot.com/advice/email.top.php
http://www.catb.org/~esr/faqs/smart-questions.html
http://support.microsoft.com/kb/555375

You cannot reply off-list:-)

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Re: neat? bash stuff that I didn't know.

2009-03-03 Thread John Summerfield

John McKown wrote:

On Fri, 27 Feb 2009, John Summerfield wrote:


will establish a TCP connection to ${PORT} on ${HOST}. Replace
/dev/tcp/... with /dev/udp/... and it will do udp instead of tcp. This
redirects stdout. Of course, using < instead of > will redirect stdin and
do a read. So, if you like "netcat" to send some data ala

command | nc ${HOST} ${PORT}

you can use the above > redirection instead and

command 
but how does one carry on a sensible conversation? I can send stuff to
sendmail, but how do I get its responses?


You can't. It is like netcat - communications is unidirectional. I guess


With netcat I can do this:
20:48 [sum...@mail ~]$ echo -ne 'GET / HTTP/1.1\nhost: www.ibm.com\n\n'
| nc -w 20 ibm.com 80
HTTP/1.1 301 Moved Permanently
Date: Tue, 03 Mar 2009 11:48:24 GMT
Server: IBM_HTTP_Server
Location: http://www.ibm.com/link/redirect.www.ibm.com/www.ibm.com/
Content-Length: 265
Content-Type: text/html



301 Moved Permanently

Moved Permanently
The document has moved http://www.ibm.com/link/redirect.www.ibm.com/www.ibm.com/";>here.

20:48 [sum...@mail ~]$

As you can see, while netcat doesn't do anything with the data, _I_ get
to see it.


if the far end sends something back over the socket, it is quietly
dropped. Netcat has the same problem. It either sends or receives, but not
both. What you'd like would be more like a bidirectional pipe, if there
were such a thing. IIRC, "pipes" in UNIX are unidirectional. So
bidirectional communications requires two pipes. Something like that might
be possible using this, but I can't really think of how. That might be a
nice enhancement both for IP communications and "piped" communications.
Perhaps a <> symbol?

cmd1 <> cmd2

could possible "cross connect" stdout of cmd1 to stdin of cmd2 as well as
stdin of cmd1 to stdout of cmd2, allowing bidirectional communications.
Use of different fd number could be possible with:

cmd1 n<>m cmd2

where n and m are numbers so that /dev/fd/n of cmd1 talks to /dev/fd/m of
cmd2 and /dev/fd/m of cmd1 to /dev/fd/n of cmd2.

The above would be complicated if somebody naively did:

cmd1 | cmd2 <> cmd3 | cmd4

In any case, unidirectionality does decrease its utility somewhat.  But I
doubt that any of us would say that piping output from one command to
another is useless because the second command cannot send anything back to
the first command. How do you get responses back from sendmail if you pipe
to it?


Using netcat, same as above. In fact, I think I have a script someplace
that uses netcat to see whether the Australian Stock Exchange is trading.

I also sometimes use netcat to test whether I can send mail to some
particular server.




--
Q: What do theoretical physicists drink beer from?
A: Ein Stein.

Maranatha!
John McKown

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390




--

Cheers
John

-- spambait
1...@coco.merseine.nu  z1...@coco.merseine.nu
-- Advice
http://webfoot.com/advice/email.top.php
http://www.catb.org/~esr/faqs/smart-questions.html
http://support.microsoft.com/kb/555375

You cannot reply off-list:-)

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Re: Which user env. variable tell me that it is in "s u - " mode ?

2009-03-03 Thread Hubert Kleinmanns
Hi Marco,

try:

echo $SHLVL

The value is incremented for each new sub shell - so it will be "1" for login 
shells (which you get with "su - ..."

Regards
Hubert


> -Ursprüngliche Nachricht-
> Von: "Marco Bosisio" 
> Gesendet: 03.03.09 11:12:04
> An: LINUX-390@VM.MARIST.EDU
> Betreff: Which user env. variable tell me that it is in  "su - "   mode ?


> Hi,
>   do you know  wich user  environment variable I have to test  (executing
> a bash script)   to know  when  I am  in   "su -"   (switch user mode)   ?
> 
> 
> Reading variables provided  by  "env"  command   then testing   $TERM  I
> am able to  know  if  not  a Linux terminal :
> ..
> ...
> # We can only execute on a terminal SSH / Telnet ,   not  executed if
> secondary console Linux/zVM
> if [[ "$TERM" != "xterm" ]] ; then  exit
> fi
> ..
> 
> I would like to do the same  when the script  is executed  in a  user
> logged  in  "su -  "   mode...
> 
> Thanks in advance.
> 
> Cordiali saluti  / Best regards
> 
>  Marco BosisioIBM Italia S.p.A.
> 
> --
> For LINUX-390 subscribe / signoff / archive access instructions,
> send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
> http://www.marist.edu/htbin/wlvindex?LINUX-390
> 

-- 
Hubert Kleinmanns
Beratung / Schulung / Projektleitung

Chairman der WG "WebSphere MQ and Business Integration" in der GSE, deutsche Region.

Tel.: +49 (0) 60 78 / 7 12 21
Fax: +49 (0) 60 78 / 7 12 25
Mobil: +49 (0) 178 / 6 97 22 54
Web: www.kleinmanns.eu
GSE: www.gsenet.de

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Which user env. variable tell me that it is in "su - " mode ?

2009-03-03 Thread Marco Bosisio
Hi,
  do you know  wich user  environment variable I have to test  (executing
a bash script)   to know  when  I am  in   "su -"   (switch user mode)   ?


Reading variables provided  by  "env"  command   then testing   $TERM  I
am able to  know  if  not  a Linux terminal :
..
...
# We can only execute on a terminal SSH / Telnet ,   not  executed if
secondary console Linux/zVM
if [[ "$TERM" != "xterm" ]] ; then  exit
fi
..

I would like to do the same  when the script  is executed  in a  user
logged  in  "su -  "   mode...

Thanks in advance.

Cordiali saluti  / Best regards

 Marco BosisioIBM Italia S.p.A.

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390