Friday, February 15, 2008

Linux存取Windows網芳

今天使用Linux machine去mount Windows網芳所分享出來的目錄時,發生了以下的錯誤:
# smbclient //X.X.X.X/temp -U lawrence
Password:
session setup failed: NT_STATUS_LOGON_FAILURE

怪了,帳號跟密碼都正確呀!看看能不能瀏覽,於是乎執行以下的command:
[root@server2 ~]# smbclient -L //X.X.X.X -N
Anonymous login successful
Domain=[XXXXX] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]

Sharename Type Comment
--------- ---- -------
cli_rpc_pipe_open: cli_nt_create failed on pipe \srvsvc to machine X.X.X.X. Error was NT_STATUS_ACCESS_DENIED
Error returning browse list: NT_STATUS_ACCESS_DENIED
session request to X.X.X.X failed (Called name not present)
session request to 10 failed (Called name not present)
Anonymous login successful
Domain=[XXXXX] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]

想了一下,會不會是Windows domain的問題,所以查了一下smbclient的man page,找到了以下的提示:
-W|--workgroup=domain
Set the SMB domain of the username. This overrides the default domain which is the domain defined in smb.conf. If the domain specified is the same as the servers NetBIOS name, it causes the client to log on using the servers local SAM (as opposed to the Domain SAM).

恩,在執行一次看看,這次加入了--workgroup的參數:
[root@server2 ~]# smbclient //X.X.X.X/temp -U lawrence --workgroup=XXXXX
Password:
Domain=[XXXXX] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
smb: \>

成功了!