I found this question while researching the magic I performed recently to do exactly this for one of my users. My workflow differs remarkably to the other answers. Do note, however, this is about the most simple case possible.
Assuming your username is ae
and your home is /home/ae
1) Set up smbfs:
mkdir /home/ae/.smb
1a) If windows login credentials are needed, create and edit the file: /home/ae/.smb/smbnetfs.conf
to have contents:
auth winuser "winpassword"
winuser
is the user created on the Windows computer you wish to access. winpassword
is that user's password to log in to Windows on that computer.
2) Create your mount point:
mkdir /home/ae/nethood
3) Execute the smbnetfs command:
smbnetfs /home/ae/nethood
Note the entire "network neighborhood" will show up under /home/ae/nethood
with the workgroups being the first layer of subdirectories.
All of the listings below were copied from my browsing of folders as a non privileged user on an ubuntu host. Username and group changed to ae
. sudo
was never used. The Windows computers are on informal Windows network and shared folders are user/password protected (on the Windows computer using the windows username and password).
$ cd nethood
$ ls -alh
total 12K
drwxrwxrwx 9 ae ae 0 Dec 31 1969 .
drwxr-xr-x 9 ae ae 21 Jul 28 11:49 ..
drwxrwxrwx 2 root root 0 Dec 31 1969 WORKGROUP
Browse the workgroup WORKGROUP
:
$ cd WORKGROUP
$ ls -alh
total 0
drwxrwxrwx 2 root root 0 Dec 31 1969 .
drwxrwxrwx 9 root root 0 Dec 31 1969 ..
lrwxrwxrwx 1 root root 11 Dec 31 1969 HTPC -> ../HTPC
lrwxrwxrwx 1 root root 14 Dec 31 1969 NEWPC -> ../NEWPC
Change directory to computers and any shared folders will be listed and accessed as normal.
$ cd NEWPC
$ ls -alh
total 0
drwxrwxrwx 2 root root 0 Dec 31 1969 .
drwxrwxrwx 9 root root 0 Dec 31 1969 ..
drwxrwxrwx 2 root root 0 Dec 31 1969 Desktop
drwxrwxrwx 2 root root 0 Dec 31 1969 Users
And the files:
$ cd Desktop/
$ ls -alh
ls: cannot access desktop.ini: No such file or directory
total 30M
drwxrwxrwx 2 root root 0 Dec 31 1969 .
drwxrwxrwx 2 root root 0 Dec 31 1969 ..
-rwxr--r-- 1 ae ae 1.5K Jan 25 2013 Command Prompt.lnk
-????????? ? ? ? ? ? desktop.ini
-rwxr--r-- 1 ae ae 156K May 28 2013 Download %25285%2529.iif
-rwxr--r-- 1 ae ae 2.4K Jul 24 12:28 Google Chrome.lnk
-rwxr--r-- 1 ae ae 178 Feb 4 2013 import orders.bat
-rwxr--r-- 1 ae ae 2.3M Mar 30 2012 msvc2008_x86_vcredist_x64.exe
drwxr-xr-x 2 ae ae 0 May 20 2014 OpenOffice 4.1.0 (en-US) Installation Files
-rwxr--r-- 1 ae ae 406K Jun 6 2013 Paypal_Jan_1_2012_to_Dec_31_2012.iif
-rwxr--r-- 1 ae ae 15M May 8 2012 php-5.4.3-Win32-VC9-x86.zip
-rwxr--r-- 1 ae ae 1.9K Jul 24 13:03 PSPad.lnk
-rwxr--r-- 1 ae ae 1.1K Jul 24 12:31 VB Demo.lnk
Notice the above directories have ownership root root
. File ownership will be the same as your user.
No other users will be able to access the folders regardless of the mount point or that folder's ownership or permissions. If your user can "write" to that folder (and it is empty), smbnetfs will mount the network neighborhood there and not allow anyone else access, even root
. For root
to have access, you must su ae
.
If there are no shared folders, the computer's directory will be empty.
If you do not have credentials to the Windows computer, you may get the error:
ls: cannot open directory .: Input/output error
fuse
group. – Takkat Feb 01 '11 at 23:23