From blag.wiki.aktivix.org

Jump to: navigation, search

I find fstab quite finicky. Here's a couple of lines I use to make it useful.


to mount a fat32 partition on a local hard drive (rw for all users) insert this line:

 /dev/hda7 /mnt/hda7 vfat auto,rw,umask=000 0 1


Problem with mounting shares is that without suid-ing it, only root can use mount. Also if root mounts something the default way, unprivileged users will only have read-only access to the mountpoint.

This entry in your fstab will allow mounting the smb share with rw access for unprivileged users (for example the X user).

 //smbserver/sharename /mnt/share/ smbfs fmask=777,dmask=777,username=smbusername,password=smbpassword, 0 0


Users of BLAG 50000 will find that using smbfs at the command line on in the fstab now gives an 'unknown file system' error. It has been replaced by cifs, instead. The mounting verbiage in the fstab has changed, as well. The older dmask=777, etc. has been updated to dir_mode=0777 (although the older phrase still seems to work).

To grant read/write access to regular users enter this line in the fstab:

 //server/share  /home/mountdirectory   cifs   username=smbusername,password=smbpassword,nocase,noperm,file_mode=0777,dir_mode=0777  0  0

Some authorities suggest putting the User ID and Group ID in the options, though I didn't find that it was nececcsary. It would look like this (obviously using your own numbers from /etc/passwd). You can substitute your username and group name for you ID numbers.

 //server/share  /home/mountdirectory   cifs   username=smbusername,password=smbpassword,nocase,noperm,uid=1000,gid=1000,file_mode=0777,dir_mode=0777  0  0

Without the noperm option you will get weird permission errors, at least if the Samba share is on a Linux server or in a Mac share folder with SMB enabled.

Some believe that including your password in the fstab is a security risk, since the file is readable by everyone with an account on your machine. They prefer to use a credentials file that normal users can not read. Start a root terminal session, then type the following four commands:

 echo username=mywindowsusername > .smbpasswd
 echo password=mywindowspassword >> .smbpasswd
 chmod 600 .smbpasswd

Then edit your fstab line to look like this:

 //server/share  /home/mountpoint  cifs credentials=/root/.smbpasswd,nocase,noperm,file_mode=0777,dir_mode=0777  0  0

--Praxis 10:07, 31 Jul 2006 (BST)

NTFS will only safely do readonly at this point unless you install fuse. To mount a NTFS partition read-only you must first install the proper driver for your version of the kernel (and update it every time you update your kernel). See NTFS.

 /dev/hda1 /mnt/windows ntfs ro,umask=0222,uid=flatcap,gid=winuser 0 0

Providing the password is supplied in fstab, the following step is NOT required. If you don't want to put the password in fstab, interactive user will be prompted for password during boot.

Stick this in rc.local and your share should be available after boot by any X user:

 mount /mnt/share

Have a nice DaY! <<<back to User:KaZim>>>

Personal tools