Posts Tagged smb share mount fstab
Mount Samba/Windows/CIFS Share with User Read/Write Permissions
Posted by Randy in Linux Stuff, Networking on March 24, 2012
Mounting a Windows/SMB/CIFS share can be accomplished in many different ways. The way that I do it works best for me, and I’m presenting it here for anyone who wants to take advantage of the info.
I have a NAS device with Windows shares on IP 192.168.1.90 on my LAN. One of the shares is called “Docs” which I use for important documents. First I create a directory to mount the share to on my local machine. I put this in my /media directory.
1 | sudo mkdir /media/Docs |
sudo mkdir /media/Docs
Note that I’m using Debian Wheezy as my distro, but all of this should work in any distro.
Next I add a line to my /etc/fstab file. It can go at the bottom of the file. So, open /etc/fstab in your favorite editor. I’m using vim.
1 | sudo vim /etc/fstab |
sudo vim /etc/fstab
The line I add for the share is:
1 | \\192.168.1.90\Docs /media/Docs cifs username=myuser,password=mypassword,uid=myuser,gid=users,auto 0 0 |
\\192.168.1.90\Docs /media/Docs cifs username=myuser,password=mypassword,uid=myuser,gid=users,auto 0 0
I set “myuser” to my actual local username. The reason I’m setting the uid in this line is because I want to specify that my user will be the owner of the mounted share (giving me read and write), and I’m setting the gid to users because I want all other users on the local machine to have read access to the mount.
After saving the file, I can sudo mount /media/Docs and I’ll have my mount available for my user. When the system reboots, the mount will automatically occur. So my user will have access to the mount directly after boot.
An optional, more secure way to do this is to put your username and password in a file somewhere (perhaps your home directory) and replace the “username=myuser,password=mypassword” part of the mount line with “credentials=/path/to/file”. This will help keep your passwords safe. Also note that these credentials aren’t your local user credentials necessarily. They can be the same, if you set your local user up with the same creds as the share, but these credentials should be the user information that gets you access to the share.
cifs share, fstab mount cifs, fstab mount windows share, smb share mount fstab, windows share mount
Tags
AJAX best double-edge razor best mechanical keyboard best php framework change password in wordpress cheap website hosting cherry mx red codeigniter codeignitor colocated servers colo servers corsair vengeance k90 css debian dedicated servers dns domain blocking ebay firefox gnome 3 sucks godaddy alternative html linux lwjgl mechanical keyboard review Open Source PHP Programming resetting a router resetting router password reset wordpress password resset wp password rosewill rk-9000 review saving passwords symfony twitter ubuntu unity sucks vps vps prices whats-hot-weekly.com x64 Linux xchat script xlack download xlack script youtube- Apple
- Applications
- Boring Stuff
- C++
- Cool Videos
- DIY
- Free Stuff
- Funny Pics
- Games
- Good Deals
- Hardware
- Health
- Home Theater
- Internet
- Internet Money
- Java
- Javascript
- Linux Stuff
- Movies
- Music
- Networking
- Open Source
- Operating Systems
- PHP
- Pipe Smoking
- Programming
- Reviews
- Science
- Security
- SEO
- Server Stuff
- Shaving
- SQL
- Stocks
- technology
- Tips
- TV
- Uncategorized
- Web Development
- Windows