[olug] Automount cifs shares in Fedora FC2/FC3
Jon H. Larsen
relayer at levania.org
Mon Nov 29 17:38:13 UTC 2004
Hi All,
Here's a handy way to mount cifs (samba) shares on system bootup.
I've done this is FC2 and FC3, YMMV in other distros.
You'll need to edit fstab, so you should be comfortable with doing so.
Login as root
Create the file /etc/samba/auth.smb in your favorite text editor.
In it, you should place the username and password for the share you plan
to connect to. It should look like this:
username=myuserid
password=mypasswd
Save it.
Protect it:
chmod 600 /etc/samba/auth.smb
This way, only root can read it.
You can create a few /etc/samba/auth.smb.whatever if different machines
have different userids/passwords. Just reference the correct
credentials=auth.* in /etc/fstab.
Next, edit /etc/fstab. Add a new line to the bottom of your /etc/fstab
like to the line below (remember, this is all one line, but your email
client will break the line, use other fstab entries as your guide):
//server/share /mnt/share cifs
nosuid,nodev,noexec,credentials=/etc/samba/auth.smb,uid=500,gid=500,file_mode=0664,dir_mode=0755
0 0
Change the uid and gid to match your own. Mine are uid=500,gid=500, as
I'm the only user on my box.
Save it.
Next, create the mount point
mkdir /mnt/share
Go into the Fedora init.d dir:
cd /etc/rc.d/init.d/
./netfs restart
You should see something close to this:
Unmounting CIFS filesystems: [ OK ]
Mounting CIFS filesystems: [ OK ]
Mounting other filesystems: [ OK ]
Make sure you add netfs to your runlevel startup.
chkconfig --add netfs
Now, your samba shares will mount each time you boot your system.
Jon L.
--
Jon H. Larsen - relayer \at\ levania \dot\ org
Omaha Linux Users Group - http://www.olug.org/
AnimeSunday.org - http://www.animesunday.org/
ICQ#: 10412618 - http://www.levania.org/~relayer/
GPG/PGP Pubkey - http://www.levania.org/~relayer/relayerpubkey.txt
More information about the OLUG
mailing list