LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-28-2014, 11:38 AM   #1
jokar.mohsen
Member
 
Registered: Jul 2008
Location: Tehran
Posts: 441

Rep: Reputation: 22
Post How can I mount a remote Location in Fstab with RW permission?


Hello All.
I use Debian 7 x64 and want to mount a Windows partition in fstab with RW permission. I use below command in fstab but it is Read-Only !!!!

//192.168.1.1/D$ /mnt/f cifs username=test,dom=Mydomain,password=XxX,rw 0 0

it show me :
mount: block device //192.168.1.1/D$ is write-protected, mounting read-only

How can I solve it?
 
Old 10-28-2014, 11:49 AM   #2
DarrenDrapkin
Member
 
Registered: Aug 2014
Location: Leeds, England
Distribution: Slackware x86 64 version 15.0
Posts: 127
Blog Entries: 3

Rep: Reputation: 27
I have not done this myself, but I would be reaching for Samba and/or NFS to do so.
 
Old 10-28-2014, 12:02 PM   #3
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Originally Posted by DarrenDrapkin View Post
I have not done this myself, but I would be reaching for Samba and/or NFS to do so.
Samba is for sharing a Linux filesystem with a Windows client
NFS is for sharing a Linux filesystem with a Linux client

Neither are what the OP is looking for. He wants CIFS, which is what he's using.

OP - my guess is the user and password you've provided for the share do not have write permissions on the Windows box. Remember, this should be the username and password for a Windows user who has write permission on the specified drive, not your Linux user/pass.

You should also make sure the mount point "/mnt/f" has the proper permissions. And it would be a good idea to put your user/pass in a special file that's only accessible by root and is referenced using the credentials argument in fstab, otherwise your Windows user/pass will be available in plain-text to literally anybody who logs into your Linux system.

FWIW - here is the fstab entry on my machine for a Windows mount with read permission for everybody and read/write permission for all members of the "source" group.
Code:
//192.168.1.118/shared	/home/shared	cifs	auto,gid=source,file_mode=0664,dir_mode=0775,iocharset=iso8859-15,credentials=/etc/sambapasswords 0 0
and the /etc/sambapasswords file:
Code:
# ls -l /etc/sambapasswords
-rw------- 1 root root 42 Aug  5  2011 /etc/sambapasswords
# cat /etc/sambapasswords
username = myuser
password = mypass

Last edited by suicidaleggroll; 10-28-2014 at 12:04 PM.
 
1 members found this post helpful.
Old 10-29-2014, 08:58 AM   #4
jokar.mohsen
Member
 
Registered: Jul 2008
Location: Tehran
Posts: 441

Original Poster
Rep: Reputation: 22
Thank you.
Make a File for username and Password is a good idea and I will do it.
About the username and password I must tell you that this Username is admin and have full permission. When I use "Connect to server" and select "Windows share" in "Type" part and use this Username, I have full permission.
What is your Idea? my "/mnt/f" directory have :

"drwxr-xr-x 1 root root 12288 Sep 20 17:10 f"

????
 
Old 10-29-2014, 09:49 AM   #5
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Try changing the group of the mount point to some group your main users are a part of (eg: users) and give the group write permission, and in the mount set the gid, file_mode, and dir_mode to give the group read/write permission.
 
Old 11-01-2014, 05:27 AM   #6
jokar.mohsen
Member
 
Registered: Jul 2008
Location: Tehran
Posts: 441

Original Poster
Rep: Reputation: 22
Hi.
I change the directory owner via below command :

chown -R mohsen:mohsen f/

and ls -l show :

drwxr-xr-x 2 mohsen mohsen 4096 Aug 9 21:29 f

but I can't create file and directories!!! Excuse me, I created "f" directory under the "/mnt" , Must I change "mnt" directory owner too?

about "/etc/sambapasswords" , I have not this file, Can I create it manually?

Thanks.
 
Old 11-05-2014, 07:02 AM   #7
jokar.mohsen
Member
 
Registered: Jul 2008
Location: Tehran
Posts: 441

Original Poster
Rep: Reputation: 22
Any Idea?
 
Old 11-05-2014, 07:05 PM   #8
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Yes create the /etc/sambapasswords file, you can name it whatever you want, doesn't matter.

Did you add the gid, file_mode, and dir_mode options from my example? That mounts it with a specific group and lets you modify the permissions appropriately so members of that group can have write access.
 
Old 11-10-2014, 05:36 AM   #9
jokar.mohsen
Member
 
Registered: Jul 2008
Location: Tehran
Posts: 441

Original Poster
Rep: Reputation: 22
Problem Solved with add "uid=1000"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy file from remote location to another remote location alsharifhoussam Linux - Server 4 01-29-2014 12:47 PM
Auto Mount using/etc/fstab a remote CIFS Windows share mccartjd Linux - Newbie 3 01-17-2012 11:52 AM
remote mount of nfs gives permission denied error - FUSE file sytem, bob.keslin@oracle.com Linux - Newbie 1 04-06-2011 04:50 PM
Help to mount remote samba share in fstab. JAgla Linux - Newbie 3 11-23-2009 02:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration