Sunday, May 6, 2007

Connect a windows network drive on Ubuntu

To connect a windows network drive to ubuntu, it is quite easy:
  1. Install smbfs:
    sudo apt-get install smbfs

  2. create the directory that will be mounted to the network drive, let's say /windows.

  3. Create a file containing the account to access the shared directory in /etc/cifspsw in the form:

    username=$(user)
    password=$(password)

    It is better if you remove access to other users for this file:
    sudo chmod og-wr /etc/cifpsw 



  4. Edit /etc/fstab and add the lines:
    $ip/$(shared directory)   /windows   cifs  noauto,exec credentials /etc/cifpsw 0 0 

    This line informs that the /windows directory will be mapped to the ip/shared directory folder.


Your configuration is ready, to mount the disk, simply write:
sudo mount /windows 


Information: You need to be root to do all these actions: you need to start all the command with the sudo command.

No comments: