Sunday, April 24, 2011

Access Windows Share from Linux Box over SMBCLIENT


1.) Ping Linux box to Windows Box
    (10.0.2.128)->(10.0.2.129)

2.) Make Windows speak LANMAN Challenge & Response
Start->Run->secpol.msc->Security Settings->Local Policies
->Security Options
 * Ntw Secu: LAN Manager Auth Level->"Send LM & NTLM Responses"
 * Ntw access: Sharing&Security modle for local acc -> Classic

3.)Group Policy may override our LANMAN C/R this can be forced by
HKLM\SYSTEM\CurrentControlSet\Control\LSA->LmCompatibilityLevel->0
Reboot

4.) Disable Simple File Sharing
XP & win2K3: Tools-> FOlder Option
-> unchk "Use Simple file sharing (Recomm)"

Vista Organize -> Folder&Search Options
-> unchk "Use Sharing Wizard (Recomm)"


[root@linux ~]# smbclient -L 10.0.2.129 -U KT -p 445
Enter KT's password:
Domain=[WORKGROUP] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]

    Sharename       Type      Comment
    ---------       ----      -------
    IPC$            IPC       Remote IPC
    test            Disk     
    ADMIN$          Disk      Remote Admin
    C$              Disk      Default share
session request to 10.0.2.129 failed (Called name not present)
session request to 10 failed (Called name not present)
Domain=[WORKGROUP] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]

    Server               Comment
    ---------            -------

    Workgroup            Master
    ---------            -------
[root@linux ~]# smbclient //10.0.2.129/test -U KT -p 445
Enter KT's password:
Domain=[WORKGROUP] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
smb: \> ls
  .                                   D        0  Sun Apr 24 09:54:36 2011
  ..                                  D        0  Sun Apr 24 09:54:36 2011
  sharingfile.txt                     A       48  Sun Apr 24 09:54:59 2011

        40915 blocks of size 262144. 27615 blocks available
smb: \> lcd /tmp/
smb: \> get sharingfile.txt
getting file \sharingfile.txt of size 48 as sharingfile.txt (7.8 kb/s) (average 7.8 kb/s)
smb: \> exit
[root@linux ~]# cat /tmp/sharingfile.txt
This is going to be shared across the Linux box.[root@linux ~]# clear

[root@linux ~]# mkdir /tmp/bala
[root@linux ~]# mount -t smbfs -o username=KT,port=445 //10.0.2.129/test /tmp/bala
Password:
[root@linux ~]# cd /tmp/bala/
[root@linux bala]# ls
sharingfile.txt
[root@linux bala]# cat sharingfile.txt
This is going to be shared across the Linux box.[root@linux bala]# cd ..
[root@linux tmp]# umount bala
[root@linux tmp]# cd bala/
[root@linux bala]# ls
[root@linux bala]#

http://www.youtube.com/watch?v=Wv5snUVF2qw



No comments:

Post a Comment