Mount It! Part 2: How to mount a local Server Share


To mount your drive, first make a directory in “/mnt” , by doing “sudo mkdir /mnt/NEW_FOLDER” where new_folder is your folder you decide to name. Make sure you have SMB installed by doing “sudo apt-get install smbfs” To check if you already have it, do “dpkg -s smbfs”. Follow the basic steps of Part I To add the server share to fstab.

Now, make a credentials file so no one can see you password over the network do :

  • sudo nano /root/.smbcredentials

If the above new file, put (user and password are of your Server’s User and Password if you have one, which you should) :

  • username=USER
  • password=PASSWORD

Now set up an easy script to mount that drive, follow the next part carefully

  • sudo nano /usr/local/bin/Mount_Server_Drive
  • then in this file add the following below :
  • mount -t cifs //server_ip/Share_Name /mnt/NEW_FOLDER/ -o credentials=/root/.smbcredentials;
  • also a “server name” can be substituted for “server ip”

Then you will want to make it executable:

  • chmod +x /usr/local/bin/Mount_Server_Drive

Now, you should be able to drop back to root:

  • cd /
  • sudo Mount_Server_Drive




About professorkaos64

Posted on 20090322, in How-To, Server and tagged , , , , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s