I40Wiki : LinuxNotes

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register

Centos 3.x


samba

smbclient -L <server> -U <yourname>

From the comand line do;
smbmount //<server>/<share> <mntpoint>

You'll need to;
chmod u+s /usr/bin/smbmnt
chmod u+s /usr/bin/smbumount

for the command if it isn't in your fstab.

If you use the command line as I do, a cool thing is to add to your .bashrc;
PASSWD=<yourpassword>
export PASSWD

Then all you need is;
smbmount //<server>/<share>

I usually have a directory in my home called mnt where I mount different shares.

man pages are good. All the docs are in /usr/share/doc/samba......

fstab


1. Install 'smbfs' & 'smbclient' (Samba File System & Samba client)
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):
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
cd ~ mkdir music


3. Mounting the share from the command line (to verify that it works):
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:
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):
//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):
//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:
sudo gedit /root/.credentials


and add the following text:
username=your_smb_username password=your_smb_password


Now, make the file only readable by root:
sudo chmod 600 /root/.credentials


6. At this point, you can either reboot or reload your fstab:
sudo shutdown -r now


sudo mount -a


7. Now, when I browse to /home/dbott/music, I have access to all the shared MP3s on my NAS device.

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.1
Page was generated in 0.5444 seconds