smbclient can be used as an "interactive" interface to a Windows machine running "ordinary" Windows networking, or to a *nix machine running an smb server.
See:
Contents
Connecting
The following work to set up an smbclient session from a Linux machine to a Windows machine on my home network where:
- Office2 and Living Room are (netbios??) host names of Windows machines, and
- OFFICE2_D and Living C are drives on those machines that have been set up for Windows sharing.
I use this under Windows 95 -- haven't tried anything more recent -- I expect it can work, but there may be some subtleties with passwords or something similar.
[dad@System8 dad]$ smbclient //Office2/OFFICE2_D
added interface ip=192.168.0.8 bcast=192.168.0.255 nmask=255.255.255.0
Got a positive name query response from 192.168.0.6 ( 192.168.0.6 )
Password:
smb: \>
[dad@System8 dad]$ smbclient //"Living Room"/"Living C"
added interface ip=192.168.0.8 bcast=192.168.0.255 nmask=255.255.255.0
Got a positive name query response from 192.168.0.2 ( 192.168.0.2 )
Password:
smb: \>
Using
Once you establish an smbclient session, you can use commands like ls, dir, cd, get, put, etc. to move files between the server and client machines. (All transfers are done in binary, which is fine for me.)
See man smbclient, starting at the heading "Operations" for more commands and details.
Puzzles
smbclient Not Working from System12
smbclient works from
system8 (and, IIRC, from
system 5) to
office6 (and, even though there is some naming confusion, the name that works with smbclient is office6, not office2) and, IIRC, I did very little, if anything, in the way of setup specific for Samba or smbclient. Also, the Samba server is not running on system8, so that apparently is not relevant to the problem on system 12.
I need to investigate the files in /etc/samba on, for example, system8 and system12. On system 12, I have:
- added office6 (and other computer names) to /etc/hosts
- modified /etc/hosts.allow and deny to allow access to localhost and all of 192.168.0
A Sample Session
rhk@system5:~/my_work/python/dive_into$ smbclient //Office6/K
added interface ip=192.168.0.5 bcast=192.168.0.255 nmask=255.255.255.0
Got a positive name query response from 192.168.0.6 ( 192.168.0.6 )
Password:
smb: \> dir
msdownld.tmp DH 0 Sat Aug 19 22:30:56 2000
---<snipped>---
python D 0 Thu Sep 4 14:17:56 2003
53609 blocks of size 16384. 4662 blocks available
smb: \> cd python
smb: \python\> ls
. D 0 Thu Sep 4 14:17:56 2003
.. D 0 Thu Sep 4 14:17:56 2003
dive_into D 0 Thu Sep 4 14:18:14 2003
53609 blocks of size 16384. 4662 blocks available
smb: \python\> cd dive_into
smb: \python\dive_into\> ls
. D 0 Thu Sep 4 14:18:14 2003
.. D 0 Thu Sep 4 14:18:14 2003
diveintopython-word-4.1.zip A 458104 Thu Sep 4 14:21:10 2003
diveintopython.doc A 0 Sun Jul 28 18:15:40 2002
53609 blocks of size 16384. 4662 blocks available
smb: \python\dive_into\> put diveintopython.doc
putting file diveintopython.doc as \python\dive_into\diveintopython.doc (366.0 kb/s) (average 366.0 kb/s)
smb: \python\dive_into\> ls
. D 0 Thu Sep 4 14:18:14 2003
.. D 0 Thu Sep 4 14:18:14 2003
diveintopython-word-4.1.zip A 458104 Thu Sep 4 14:21:10 2003
diveintopython.doc A 1820672 Thu Sep 4 15:06:22 2003
53609 blocks of size 16384. 4551 blocks available
smb: \python\dive_into\> exit
rhk@system5:~/my_work/python/dive_into$
How to Use mget without Prompting?
Contributors
- RandyKramer - 11 Jun 2001
(transferred from swiki)
- <If you edit this page, add your name here, move this to the next line>