Вы находитесь на странице: 1из 1

Mounting network shares at boot Question: I mapped (mounted) a remote network share, but when I reboot the compu

ter it disappears. Is there a way to make the link to my shared network folder p ermanent? Answer: Yes, indeed, network shares can be set up to mount automatically. There are just a few steps to perform to get the desired effect. The first thing we sh ould do is put a couple of things in place in our home directory. The remote sha re will need a directory where we can attach it to our system. In this case I'm going to create a folder in my home directory called Shared: mkdir ~/Shared Also in the home directory we should create a file with our credentials for acce ssing the remote share. In this example I'm going to assume the remote share is a Samba share. In my home directory I create a file called MyCredentials and pla ce the following two lines inside the file: username=user password=pass Then I make sure I'm the only user who can access the file by changing its permi ssions: chmod 600 MyCredentials The next step is to add an entry to our /etc/fstab file. This file contains a li st of all the file systems our operating system recognizes and instructs the sys tem where to mount these file systems. By default we will probably find at least three entries in our /etc/fstab file, one for the root (/) file system, one for swap space and one for the /proc directory. What we will need to do is add an a dditional line which will instruct our operating system how to handle the remote share. The first item on the line will be the location of the share on our network and the second item will be the location where we wish to mount the share. The third field specifies the type of share and then we provide a few parameters telling the OS how to go about connecting to the share. Really, the only required part o f this forth field is the location of our credentials file we created in the pre vious step: //remotebox/myshare /home/user/Shared smbfs credentials=/home/user/MyCredentials ,noatime,nofail 0 0 If we were connecting to a NFS share rather than a Samba share a similar line wo uld work, but with the file system type, "smbfs", changed to "nfs". Once the app ropriate line has been added to our /etc/fstab file we can test to make sure it works by running: mount -a The Just Linux website has more details on the various options which can be used when mounting Samba shares and the NFS manual page has examples and options for automatically connecting to NFS shares. Samba shares: http://www.justlinux.com/nhf/Filesystems/Mounting_smbfs_Shares_Per manently.html NFS manual page: http://linux.die.net/man/5/nfs

Вам также может понравиться