Skip to content

How to mount a network drive (Samba share) on Linux

March 5, 2009

Make sure ‘smbfs’ package is installed.

Mount Manually

# mkdir -p /mnt/win
# mount -t cifs -o username=winntuser,password=mypassword //windowsserver/sharename /mnt/win
# cd /mnt/win
# ls -l

Mount at every system start

Edit the file ‘/etc/fstab’

# vi /etc/fstab

Append following line in a single line

//windowserver/share /mnt/win cifs credentials=/etc/.sambapasswords,iocharset=utf8,_netdev 0 0

Next, create the password file

# vi /etc/.sambapasswords

and add following content

username = winntuser
password = mypassword

Now, make sure only root can access your file

# chown 0.0 /etc/.sambapasswords
# chmod 600 /etc/.sambapasswords

Advertisement
No comments yet

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

Follow

Get every new post delivered to your Inbox.