Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Forum Archive > Main Support Categories > Networking & Wireless
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Hello, Unregistered You are browsing a READ only archive of the main support categories pre 4/21/2008. You will not be able to post or reply any threads in this section.
Ubuntu 9.10 is out!!!

When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu.

The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely.

Networking & Wireless
Having problems getting connected to the internet or getting your wireless card to work? Ask here.

 
Thread Tools Display Modes
Old October 19th, 2006   #1
dbott67
Chocolate Ubuntu Mocha Blend
 
dbott67's Avatar
 
Join Date: Mar 2005
Location: St Catharines, ON, Canada
Beans: 1,769
Ubuntu 7.10 Gutsy Gibbon
Send a message via MSN to dbott67
HOWTO: Mounting SMB/CIFS Shares

Update: November 18, 2007

A few of the downsides on the Nexstar LX NAS device that I purchased is that:
1. It does not support CIFS
2. It does not support SATA drives (IDE only)
3. It is 10/100 Mbps (no gigabit)
4. It does not have any fault tolerance.

It is, however, an inexpensive device that can be used to share data among many computers.

Anyhow, I have been in the process of upgrading my home network to gigabit and wanted to purchase a better NAS device that had some redundancy & expandability, as well as support for gigabit, CIFS and SATA drives (hot-swappable, no less). I ended up purchasing a Netgear (formerly Infrant) ReadyNAS NV+ 4250 and am providing an update to my original instructions using CIFS rather than smbfs:

Steps 1 and 2 remain the same.

In step 3, test mount the share using CIFS as noted:

Code:
dbott@gutsy:~$ sudo mount -t cifs //192.168.1.2/Music /home/dbott/Music -o iocharset=utf8,file_mode=0777,dir_mode=0777
Step 4 remains the same.

Step 5, add the mount point(s) to your /etc/fstab file:
Code:
//192.168.1.2/Music /home/dbott/Music   cifs  credentials=/root/.credentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0
//192.168.1.2/dbott /home/dbott/Data   cifs  credentials=/root/.credentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0
//192.168.1.2/Archive /home/dbott/Archive   cifs  credentials=/root/.credentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0
The only issue that I encountered was with regards to UIDs. My user account on Ubuntu (dbott) has a UID of 1000, while my user account on the NAS has a UID of 1004. To fix this, I changed my Ubuntu UID to match the UID on the Netgear NAS using the following command:
Code:
sudo usermod --uid 1004 dbott
After a couple of minutes and a reboot, everything was working properly.


Original Post: October 2006


I purchased a NexStar LX NAS device and wanted to mount some of the shares on my linux computers. I configured my NAS device with a static IP (192.168.1.2) and created a number of shares to store my data. This process can be used to mount any SMB or Windows shared folder:

1. Install 'smbfs' & 'smbclient' (Samba File System & Samba client)
Code:
sudo apt-get install smbfs smbclient
After installing the above, issue the command smbclient -L 192.168.1.2 -U% to generate a list of available shares (replace 192.168.1.2 with the IP or name of your SMB server):
Code:
dbott@thedrake:~$ smbclient -L 192.168.1.2 -U%

        Sharename       Type      Comment
        ---------       ----      -------
        PUBLIC          Disk
        Data            Disk
        Archive         Disk
        Music           Disk
        IPC$            IPC

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

        Workgroup            Master
        ---------            -------
2. Create new folder for the 'mount point'. In my case, I wanted the shared music folder to be mounted to the following location /home/dbott/music
Code:
cd ~
mkdir music
3. Mounting the share from the command line (to verify that it works):

Code:
sudo smbmount //192.168.1.2/Music /home/dbott/music -o username=dbott,password=mysecretpassword,uid=1000,mask=000
4. Un-mounting the share from the command line:

Code:
sudo smbumount /home/dbott/music
5. Add the mount point to fstab (making it 'automatic'):

The unsafe way (fstab is world-readable, meaning that anyone can see your SMB username and password):
Code:
//192.168.1.2/Music /home/dbott/music   smbfs  auto,username=dbott,password=mysecretpassword,uid=1000,umask=000,user   0 0
The better way (storing your username & password in a file only readable by root):
Code:
//192.168.1.2/Music /home/dbott/music   smbfs  auto,credentials=/root/.credentials,uid=1000,umask=000,user   0 0
/root/.credentials is a text file that contains your smb username and password. To create the file, type:
Code:
sudo gedit /root/.credentials
and add the following text:
Code:
username=your_smb_username
password=your_smb_password
Now, make the file only readable by root:
Code:
sudo chmod 600 /root/.credentials
6. At this point, you can either reboot or reload your fstab:
Code:
sudo shutdown -r now
Code:
sudo mount -a
7. Now, when I browse to /home/dbott/music, I have access to all the shared MP3s on my NAS device.

-Dave

Last edited by dbott67; November 18th, 2007 at 04:49 PM.. Reason: Added CIFS instructions
dbott67 is offline   Reply With Quote
Old October 20th, 2006   #2
barq
First Cup of Ubuntu
 
Join Date: Oct 2006
Location: Guildford, UK
My beans are hidden!
Kubuntu 6.06 Dapper
Re: HOWTO: Mounting SMB Shares

Thank you, this was really useful to me.
barq is offline   Reply With Quote
Old October 26th, 2006   #3
dbott67
Chocolate Ubuntu Mocha Blend
 
dbott67's Avatar
 
Join Date: Mar 2005
Location: St Catharines, ON, Canada
Beans: 1,769
Ubuntu 7.10 Gutsy Gibbon
Send a message via MSN to dbott67
Re: HOWTO: Mounting SMB Shares

BROWSING SHARES FROM A GUI

Depending on which version of Ubuntu you use (Gnome, KDE, XFCE, etc.), you may not be able to graphically connect to a Samba share.

If you just want to connect to one from a command line, you'll need 'smbfs' (SMB file System) and 'smbclient' (SMB client). Nautilus does allow browsing but there appears to be some known bugs when browsing via 'workgroup' or by 'computer name'. Apparently, browsing by IP address work okay. You can try installing 'linneighborhood' or pyNeighborhood to see if works better than Nautilus for browsing via GUI.

Code:
sudo apt-get intsall smbfs smbclient linneighborhood
You should be able to browse SMB shares from the command line (just substitute 192.168.1.2 with the IP address or hostname of your SMB server), using the following command:

Code:
smbclient -L 192.168.1.2 -U%
Code:
dbott@thedrake:~$ smbclient -L 192.168.1.2 -U%

        Sharename       Type      Comment
        ---------       ----      -------
        PUBLIC          Disk
        Data            Disk
        Archive         Disk
        Music           Disk
        IPC$            IPC

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

        Workgroup            Master
        ---------            -------
If that command works, you should be all set with 'LinNeighborhood'. I just installed it & everything seems to work... just type LinNeighborhood& from the terminal to get started (the trailing '&' puts the process in the background and returns control to the terminal window). See attached screenshot.

-Dave
Attached Thumbnails
Click image for larger version

Name:	LinNeighborhood.png
Views:	3792
Size:	625.1 KB
ID:	18244   Click image for larger version

Name:	ln2.jpg
Views:	2826
Size:	217.4 KB
ID:	18245  

Last edited by dbott67; November 17th, 2006 at 11:05 AM..
dbott67 is offline   Reply With Quote
Old November 17th, 2006   #4
dbott67
Chocolate Ubuntu Mocha Blend
 
dbott67's Avatar
 
Join Date: Mar 2005
Location: St Catharines, ON, Canada
Beans: 1,769
Ubuntu 7.10 Gutsy Gibbon
Send a message via MSN to dbott67
Re: HOWTO: Mounting SMB Shares

Also, some issues arise because of the way SMB shares "announce" themselves to the network. Generally, connecting via IP address works properly, but browsing by 'computer name' can occasionally fail. Windows uses WINS service to allow users to browse by computer name (also known in Windows-speak as Netbios name). WINS binds the computer name to the IP address. For the most part, this has been superceded by DNS, which binds the fully-qualified domain name to the IP address. The problem is that DNS resolution requires that:

a) You're running a DNS server
b) Each client is registered in the DNS server

The problem here is that most people don't run their own DNS server and if you have any Windows computers on the network (or Samba shares), you really should have a WINS server or 'winbind' installed.

There is a package in the repositories called 'winbind' that will allow you to browse by computer name.

This info is provided by 'featherking' from this thread:

Code:
sudo gedit /etc/nsswitch.conf
find this line (it may not be exactly that)

Code:
hosts:          files dns mdns
and add wins, so now it looks like

Code:
hosts:          files dns mdns wins
then install winbind
Code:
sudo apt-get install winbind
Now trying connecting to "Places->Network Servers".

-Dave
dbott67 is offline   Reply With Quote
Old November 30th, 2006   #5
DerHesse
Gee! These Aren't Roasted!
 
Join Date: Jun 2006
Location: Kassel, Germany
My beans are hidden!
Ubuntu 8.10 Intrepid Ibex
Re: HOWTO: Mounting SMB Shares

A nice guide!!! Thank you.

...but what if the Server holding the shares is Window and is domain member.


I tried with a local account on the Windows machine, but no chance.

sudo smbmount //192.168.1.2/Music /home/dbott/music -o username=dbott,password=mysecretpassword,uid=1000,mask=000

doesn't really make sense.

Do you see any chance to get that working?
DerHesse is offline   Reply With Quote
Old December 3rd, 2006   #6
coln_panic
First Cup of Ubuntu
 
Join Date: May 2006
Beans: 9
Re: HOWTO: Mounting SMB Shares

Quote:
Originally Posted by DerHesse View Post
...but what if the Server holding the shares is Window and is domain member.
so to clarify, you want to connect your ubuntu machine(a) to a windows box(b) share, where the (b) is a member of a domain? this certainly should be possible, especially if you have admin rights on (b). what version of windows is (b) running, what kind of share are you trying to connect to and how to you want to authenticate who can connect to the share(none - share level access, local accounts okay, domain accounts okay, other?)?

you also said that
Code:
sudo smbmount //192.168.1.2/Music /home/dbott/music -o username=dbott,password=mysecretpassword,uid=1000,mask=000
didn't make sense to you, why not?

include any other information that you think may be helpful,

jay
coln_panic is offline   Reply With Quote
Old December 3rd, 2006   #7
adamkane
100% Pure Ubuntu
 
adamkane's Avatar
 
Join Date: Mar 2006
Location: Toronto, Canada
Beans: 857
Send a message via MSN to adamkane Send a message via Yahoo to adamkane Send a message via Skype™ to adamkane
Re: HOWTO: Mounting SMB Shares

Great HOWTO. Too bad the thread name is so generic.
adamkane is offline   Reply With Quote
Old December 4th, 2006   #8
dbott67
Chocolate Ubuntu Mocha Blend
 
dbott67's Avatar
 
Join Date: Mar 2005
Location: St Catharines, ON, Canada
Beans: 1,769
Ubuntu 7.10 Gutsy Gibbon
Send a message via MSN to dbott67
Re: HOWTO: Mounting SMB Shares

Quote:
Originally Posted by DerHesse View Post
A nice guide!!! Thank you.

...but what if the Server holding the shares is Window and is domain member.


I tried with a local account on the Windows machine, but no chance.

sudo smbmount //192.168.1.2/Music /home/dbott/music -o username=dbott,password=mysecretpassword,uid=1000,mask=000

doesn't really make sense.

Do you see any chance to get that working?
From bmedwar in this thread:

Quote:
Originally Posted by bmedwar View Post
Thanks. It would be awesome to integrate this with the Places -> Connect to server... (or make it more obvious that connect to server is not doing an smbmount)

Here is what I did to make this work with domain authentication.

Mounting SMB Shares with domain authentication
==============================================

Add line in /root/.smbcreds, 'domain = <domain name>'. This is used by smbclient, but ignored by smbmount. For smbmount specify the domain as the workgroup on the command line.

List the available shares (helpful for determining upper/lower case names):
Code:
sudo smbclient -L bedwards2 -U% -A /root/.smbcreds
Mount from command line:
Code:
sudo smbmount //bedwards2/C$ /mnt/bedwards2_c/ -o workgroup=INSIDE,credentials=/root/.smbcreds,dmask=777,fmask=777
Mount in /etc/fstab:
Code:
//bedwards2/C$  /mnt/bedwards2_c smbfs  auto,workgroup=INSIDE,credentials=/root/.smbcreds,uid=1000,umask=000,user   0 0
dbott67 is offline   Reply With Quote
Old December 6th, 2006   #9
marx2k
Quad Shot of Ubuntu
 
Join Date: Oct 2006
Location: Wisconsin
Beans: 454
Ubuntu 6.10 Edgy
Send a message via AIM to marx2k
Re: HOWTO: Mounting SMB Shares

VERY basic question here...
I made a directory in ~/Desktop:
Code:
|-- RemoteShared
|   `-- UbuntuLivingroom
|       `-- Music
|           |-- Collection1
|           |-- Collection2
|           |-- Collection3
|           |-- Collection4
|           |-- Documents
|           |-- Pictures
|           `-- ReadWrite
My plan is to have one folder on my desktop with these remote SAMBA shares in it.

my /etc/fstab of the relevant section:
Code:
#SAMBA Shares
//192.168.11.8/MyMusic1 /home/marx2k/Desktop/RemoteShared/UbuntuLivingroom/Music/Collection1   smbfs  auto,credentials=/root/.credentials,uid=1000,umask=000,user   0 0
//192.168.11.8/MyMusic2 /home/marx2k/Desktop/RemoteShared/UbuntuLivingroom/Music/Collection2   smbfs  auto,credentials=/root/.credentials,uid=1000,umask=000,user   0 0
//192.168.11.8/MyMusic3 /home/marx2k/Desktop/RemoteShared/UbuntuLivingroom/Music/Collection3   smbfs  auto,credentials=/root/.credentials,uid=1000,umask=000,user   0 0
//192.168.11.8/MyMusic4 /home/marx2k/Desktop/RemoteShared/UbuntuLivingroom/Music/Collection4   smbfs  auto,credentials=/root/.credentials,uid=1000,umask=000,user   0 0
//192.168.11.8/MyDocuments /home/marx2k/Desktop/RemoteShared/UbuntuLivingroom/Music/Documents   smbfs  auto,credentials=/root/.credentials,uid=1000,umask=000,user   0 0
//192.168.11.8/MyPictures /home/marx2k/Desktop/RemoteShared/UbuntuLivingroom/Music/Pictures   smbfs  auto,credentials=/root/.credentials,uid=1000,umask=000,user   0 0
//192.168.11.8/shared /home/marx2k/Desktop/RemoteShared/UbuntuLivingroom/Music/ReadWrite   smbfs  auto,credentials=/root/.credentials,uid=1000,umask=000,user   0 0
And everything mounts fine. However, instead of just the one folder with everything in it, I get that folder with everything in it PLUS a drive icon for each share that I mount on my desktop in random locations.

How do I keep Ubuntu from throwing those extra icons on my desktop automatically?
marx2k is offline   Reply With Quote
Old December 6th, 2006   #10
dbott67
Chocolate Ubuntu Mocha Blend
 
dbott67's Avatar
 
Join Date: Mar 2005
Location: St Catharines, ON, Canada
Beans: 1,769
Ubuntu 7.10 Gutsy Gibbon
Send a message via MSN to dbott67
Re: HOWTO: Mounting SMB Shares

There is a setting in gconf-editor that allows volumes to be hidden/visible on the desktop. From a terminal, type:
Code:
gconf-editor
Browse to /apps/nautilus/desktop and uncheck "volumes_visible" (see attached screen shot).

-Dave
Attached Thumbnails
Click image for larger version

Name:	volumes_visible.png
Views:	1641
Size:	143.9 KB
ID:	20656  
dbott67 is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:14 AM.


vBulletin ©2000 - 2009, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry