Saturday, November 14, 2009

0

How to mount network drive manually and auto in ubuntu

Posted in ,
Manual mount

On your terminal type choose on the ffollowing command depending your need

 For a samba server with password protection:

Code:

sudo mount -t cifs //netbiosname/sharename /media/sharename -o sername=winusername,password=winpassword,iocharset=utf8,file_mode=0777,dir_mode=0777


 If your samba share does not require a password just use the following line instead:
Code:
sudo mount t -t cifs //netbiosname/sharename /media/sharename -o guest,rw,iocharset=utf8,file_mode=0777,dir_mode=0777

 If your guest access does not allow write access, just remove the file and dir modes like so:
Code:

sudo mount -t cifs //netbiosname/sharename /media/sharename -o guest,iocharset=utf8

Permanent mount
create a file using the following instruction and command
  1. Open a terminal then type in su root and supply the password
  2. cd /root/ the enter
  3. create a file name .smbcredentials on root type touch .smbcredentials
  4. vim credentials
  5. on you keyboard press i to insert then add the following
    • username=joemar
    • password=sinister08
  6. then save press : wg to save
  7. change the permission chmod 777 .smbcredentials
Now we edit fstab:
Code:
nano /etc/fstab
and at the end of the file, insert one (1) of the following 3 lines according to your needs. Make sure you change "netbiosname" and "sharename" to the correct names for the server you are trying to connect to. (if you don't know what these are, please see the next post)

 For a password protected share with read/write permission.

Code:
//netbiosname/sharename /media/sharename cifs credentials=.smbcredentials,iocharset=utf8

For a non-password protected share with read/write permission use this instead:
Code:
//netbiosname/sharename /media/sharename cifs guest,rw,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0
 For read only guest access:
Code:
//netbiosname/sharename /media/sharename cifs guest,iocharset=utf8 0 0

Finally, test your settings to make sure they work:

Code:
sudo mount -a

0 comments: