Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How To: Auto Mount Samba Shares on Boot ( GVFS Method )
- Postby altair4 on Wed Feb 24, 2010 1:21 pm
- Auto Mount Samba Shares on Boot ( GVFS Method )
- Updated to include Mint Debian Changes
- Prerequisites
- This HowTo assumes you can connect to a remote share from Nautilus. If you cannot, this HowTo will not help you. If you have problems connecting to a remote share manually I suggest you post a separate topic asking for help.
- Linux Mint Debian Edition Prerequisites
- You need to install one package:
- Code: Select all
- sudo apt-get install gvfs-fuse
- You need to add yourself to the fuse group:
- Code: Select all
- sudo gpasswd -a your_user_name fuse
- You need to logoff and login again for the group to actually change.
- GVFS
- When you use Nautilus to access a samba share manually you may not know that Nautilus actually creates a mount point. The problem is it's in a hidden directory. You have to enable Nautilus to "see" that directory by going to:
- Nautilus > Edit > Preferences > View > Show hidden and backup files.
- The mount point is at :
- /home/your_user_name/.gvfs ( note the "." in front of the gvfs - that indicates a hidden directory )
- Procedure
- Step 1: Connect to the Server from Nautilus
- Nautilus > Network > Workgroup > Machine > Share
- If the server requires authentication then enter it and click on the "remember forever" option before entering "Connect"
- Once you have successfully connected go back and unmount the remote share.
- Step 2: Connect from the terminal
- Open Terminal
- Type gvfs-mount smb://Server/share_name
- Substitute the actual "Server" and "Share_name" for the ones above
- The "Server" in that command can take many forms, for example:
- gvfs-mount smb://WinXP/share_name
- gvfs-mount smb://WinXP.local/share_name
- gvfs-mount smb://192.168.0.100/share_name
- The last one is by ip address of the server which is the most reliable method.
- Make sure this remounts the remote share to /home/user_name/.gvfs without prompting for authentication.
- Step 3: Create a script that will automate this process and place it in the Autostart folder:
- Open Terminal
- Type gedit
- Enter the following:
- #!/bin/sh
- while true
- do
- if initctl status nmbd|grep -c running
- then
- gvfs-mount smb://Server/share_name
- exit 0
- fi
- sleep 5
- done
- Again, Substitute the actual "Server" and "Share_name" for the ones above
- Save the file as, for example: /home/user_name/share_name_mount.sh
- Exit gedit
- Back in the terminal make the script executable by issuing the command:
- chmod +x /home/user_name/share_name_mount.sh
- Go to Menu > Preferences > Startup Applications > Add > point it to /home/user_name/share_name_mount.sh.
- Logoff and logon again and you should have your share mounted to /home/user_name/.gvfs/ automatically ( assuming the server is running ) and you should have a mount icon on your desktop.
- Issues
- []Your Specific Application Cannot Access The Hidden Mount Point
- One way around this is to create a symlink to the .gvfs folder. For example:
- Open Terminal
- Type mkdir /home/your_user_name/LanShare
- Type ln -s /home/your_user_name/.gvfs/"share_name on host_name" /home/your_user_name/LanShare
- Another way to do this is to create a bookmark to the .gvfs folder so that is shows up in the Open and Save boxes:
- Run the following command:
- Code: Select all
- nautilus $HOME/.gvfs
- *** Bookmark that location: Bookmarks > Add Bookmark
- *** Right click the resulting ".gvfs" bookmark > Rename and rename to LanShares for example. It should then be visible in your application as LanShares.
- []Multiple Samba Shares.
- If you have many shares you want to automount you may be tempted to create one script with many gvfs-mount lines in them.
- I would advise against that. I have found that if one of them fails, all subsequent lines will not be executed. What I do is simply create a separate script for each share I want to mount.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement