LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-27-2013, 08:14 AM   #1
spangler
Member
 
Registered: Apr 2007
Posts: 45
Blog Entries: 1

Rep: Reputation: 15
Permission denied on a samba share


I am running 3 servers. The share is located on an Oracle Linux 6.2 server. I created mount points on an Oracle Linux 6.3 server and a SuSE Linux 10.3 server. Here is the share
[share]
comment = Shared folder for Nortridge
path = /data/share
writeable = yes
browseable = yes
read only = no
locking = no
create mask = 0777
directory mask = 0777

This is the mount command I used on both servers
mount -t smbfs //RemoteServer/share /share -o username=userID,file_mode=0777,dir_mode=0777

I created the user account using smbpasswd -a username

The file permissions after it is mounted is 777 owned by root:root. I am not able to write to it as root or the user I tried to mount it as.
 
Old 03-28-2013, 12:45 AM   #2
eklavya
Member
 
Registered: Mar 2013
Posts: 636

Rep: Reputation: 142Reputation: 142
Try to put this attribute
Code:
force user = root
with your defined attribute and restart samba.
Now try to access & write.

Last edited by eklavya; 03-28-2013 at 03:22 AM.
 
Old 03-28-2013, 07:33 AM   #3
spangler
Member
 
Registered: Apr 2007
Posts: 45

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Still getting permission denied
 
Old 03-28-2013, 10:04 AM   #4
eklavya
Member
 
Registered: Mar 2013
Posts: 636

Rep: Reputation: 142Reputation: 142
This is command to mount shared directory
Code:
mount -t smbfs -o username=username //remote-server-IP/directory-name /where-you-want-to-mount
Suppose in MY LAN, there is a remote server whose IP is 192.168.2.70. The username is user who has shared a directory in his system. The directory name is linux.
I want to mount it in my desktop directory d1. I will run following command

Code:
mount -t smbfs -o username=user //192.168.2.70/linux /root/Desktop/d1
It will ask password of user. After that, it will show all contents of the directory linux in my directory d1.

Last edited by colucix; 03-28-2013 at 11:37 AM. Reason: Cleaned erroneous dupe.
 
Old 03-28-2013, 01:30 PM   #5
spangler
Member
 
Registered: Apr 2007
Posts: 45

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Yes. I am able to mount the share just fine. What I cannot do is write to it. I am not able to write to it as the user that I used to mount the share or as the root user.

Last edited by spangler; 03-28-2013 at 01:31 PM.
 
Old 03-29-2013, 12:00 AM   #6
eklavya
Member
 
Registered: Mar 2013
Posts: 636

Rep: Reputation: 142Reputation: 142
Code:
force user = username-of-the-remote-server-who-shared-the-directory
and add
Code:
guest ok = yes
add these lines in smb.conf of the server where files are shared (your Oracle Linux 6.2 server).
Restart samba there.
Have you defined work group correctly on other two servers where you want to see the shared files of Oracle Linux 6.2?
If it still does not work then try to give 777 to shared directory.
Now try to write into directory.
 
Old 03-31-2013, 01:55 AM   #7
zafar_dandoti
Member
 
Registered: Dec 2005
Location: India
Distribution: centos
Posts: 178

Rep: Reputation: 13
you say you can mount the share and read but cant write to it, are the mount points writable to samba users?
 
Old 04-01-2013, 01:30 PM   #8
spangler
Member
 
Registered: Apr 2007
Posts: 45

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Yes they are writeable by users. I have in the smb.conf writeable = yes
 
Old 04-01-2013, 04:04 PM   #9
SteveK1979
Member
 
Registered: Feb 2004
Location: UK
Distribution: RHEL, Ubuntu, Solaris 11, NetBSD, OpenBSD
Posts: 225

Rep: Reputation: 43
Hi,

Might be a stupid question, but if you're trying to share this to two other linux machines, can you not just use NFS?

Cheers,
Steve
 
Old 04-01-2013, 06:52 PM   #10
adayforgotten
LQ Newbie
 
Registered: Apr 2013
Location: USA
Distribution: Ubuntu
Posts: 9

Rep: Reputation: Disabled
Filesystem permissions

What are the file permissions of the directory you are sharing? It doesn't matter if you do 'writeable=yes' or 'read only=no' if the FILESYSTEM permissions aren't set right.

The user which you created with the smbpasswd command must be the owner or a member of the group on the directory which you are sharing (and anything in it). Furthermore, the user/group must have the rwx permission.

You could also try the cifs package instead of smbfs. smbfs is outdated and should only be used if cifs is not an option. It is similar in syntax, so it would not require much change once the correct packages are installed.
 
Old 09-22-2017, 02:23 PM   #11
s0nic
LQ Newbie
 
Registered: Sep 2017
Posts: 1

Rep: Reputation: Disabled
Hello,

I had this same problem, but only when trying to create a share inside /var/www on CentOS 7. SELinux didn't like that. I could mount the share and everything, but I could not read, write or execute (or even see) the files in the share.

To see if you have SELinux enabled run:
Code:
sestatus
If it is active you will see the following output, or something similar:
# sestatus
Code:
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      28

Check /var/log/audit/audit.log while you are trying to access the share to see if anything comes up.

The easiest and least secure way to fix this is to allow samba to read/write anywhere:
Code:
setsebool -P samba_export_all_rw 1
This change will take effect immediately. You can restart samba for good measure, but it shouldn't be necessary. When I say the command will allow samba to read/write anywhere of course standard filesystem permissions apply, SELinux just won't block it.

If you want to be more specific, you can run:

Code:
chcon -t public_content_rw_t /data/share
setsebool -P allow_smbd_anon_write 1
Alternatively you could run audit2allow to build a module to allow what SELinux is blocking. However, it shouldn't be necessary with the above commands.

To temporarily turn off SELinux altogether, as root run:
Code:
echo 0 > /selinux/enforce
This is a 4 year old thread, but hopefully this info helps someone..

s0nic
 
  


Reply



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
[SOLVED] Samba 3.2.5: share "does not exist or permission denied when connecting to [...]" diagnoe Linux - Server 3 10-01-2010 03:51 AM
Help with mounting samba share: smbmount or mount.cifs error: permission denied wdli Linux - Server 1 08-11-2009 11:31 PM
Permission denied on Samba share Peter Aleksic *BSD 5 03-20-2009 08:18 AM
Samba Share Mounts but Permission Denied pccdrussell Linux - Software 1 12-16-2007 06:21 AM
Can't access my linux share through samba. I get permission denied. mlsbraves Linux - Software 1 08-16-2005 07:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:03 AM.

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