[samba] mount / net script met OS detect

Pagina: 1
Acties:

  • Zym0tiC
  • Registratie: Februari 2001
  • Laatst online: 05:40
Ik draai nu een samba PDC. Fijn batch bestanden aangemaakt voor de users dat wanneer ze onder windows inloggen bepaalde mappings worden gemaakt.

Nu wou ik ook graag hebben dat als ik onder linux inlog bepaalde mounts worden gemaakt afhankelijk van de user. Nu is dat maken van zo'n script geen probleem maar ik wou graag voor iedere user 1 mount /netlogon script hebben maar dat aan het begin word gedetecteerd welk os draait (win of linux) en dan de juiste code word uitgevoerd.

There is no such thing as innocence, only degrees of guilt | Flickr!


  • Equator
  • Registratie: April 2001
  • Laatst online: 07:38

Equator

Crew Council

#whisky #barista

Aangezien een batch bestand niet draait onder linux, en een bash script niet wil werken onder windows ben ik bang dat 1 script niet zal werken.

  • 0xDEADBEEF
  • Registratie: December 2003
  • Niet online
Als je een absolute afsplitsing wilt maken van Windows en Linux, kijk eens naar nmap; deze kan OS-detectie doen.

En http://ftp.easynet.be/samba/docs/man/smbclient.1.html:
-I IP-address

IP address is the address of the server to connect to. It should be specified in standard "a.b.c.d" notation.

Normally the client would attempt to locate a named SMB/CIFS server by looking it up via the NetBIOS name resolution mechanism described above in the name resolve order parameter above. Using this parameter will force the client to assume that the server is on the machine with the specified IP address and the NetBIOS name component of the resource being connected to will be ignored.

There is no default for this parameter. If not supplied, it will be determined automatically by the client as described above.


http://ftp.easynet.be/samba/docs/man/findsmb.1.html:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
For example, running findsmb without -r option set would yield output similar to the following:
IP ADDR         NETBIOS NAME   WORKGROUP/OS/VERSION 
--------------------------------------------------------------------- 
192.168.35.10   MINESET-TEST1  [DMVENGR]
192.168.35.55   LINUXBOX      *[MYGROUP] [Unix] [Samba 2.0.6]
192.168.35.56   HERBNT2        [HERB-NT]
192.168.35.63   GANDALF        [MVENGR] [Unix] [Samba 2.0.5a for IRIX]
192.168.35.65   SAUNA          [WORKGROUP] [Unix] [Samba 1.9.18p10]
192.168.35.71   FROGSTAR       [ENGR] [Unix] [Samba 2.0.0 for IRIX]
192.168.35.78   HERBDHCP1     +[HERB]
192.168.35.88   SCNT2         +[MVENGR] [Windows NT 4.0] [NT LAN Manager 4.0]
192.168.35.93   FROGSTAR-PC    [MVENGR] [Windows 5.0] [Windows 2000 LAN Manager]
192.168.35.97   HERBNT1       *[HERB-NT] [Windows NT 4.0] [NT LAN Manager 4.0]

"Religion is an insult to human dignity. With or without it you would have good people doing good things and evil people doing evil things. But for good people to do evil things, that takes religion." - Steven Weinberg