Samba able to copy folders but unable to copy files - linux

I am currently using CentOS 6.5 and trying to share files over a samba share. On the other machine is Windows 8 x64. I am able to transfer folders from Windows to CentOS over without issues but however, when I try to copy a single file over to CentOS, I get permission denied error on Windows.
Permissions of the folder is as follows:
drwxrwxrwx. 5 user01 smbusers 4096 Feb 28 23:23 srv
And the smb.conf:
[srv]
comment = Data
path = /srv
browseable = yes
writable = yes
read only = no
valid users = #smbusers
workgroup = WORKGROUP
create mask = 0775
directory mask = 0775
I would like to know what is the problems that is preventing me from copying files over but not folders. Contents inside the folders get copied over without issues. Help appreciated. Thanks in advance!

Try to change the owner of directory/folder where you are going to copy the file in CentOS from Windows, it's usually done by chown command. For example if you want to the change the owner of directory named share from root to your_user_name, you can do this by following command,
sudo chown your_user_name share
This will change the owner of share folder to your login user.

Related

Vsfp user don't see any data linux Rhel/Centos

I tried creating vsftp server on Rhel 8 and centos. My ftp Users can login into server but only sed list of directory's and are able to navigate to any directory.
User cannot create directory or file
User cannot see any files in any directory.
I chnage chmod 777
And changed ownership but nothing works
It was selinux config I had to change under /etc/selinux/config
changed enforcing to disable

process_usershare_file: stat of failed. Permission denied Samba

I created a shared folder using samba in ubuntu to enable windows machines can access it with the following command:
$ sudo net usershare add documents /home/developer/documents "Developer documents" everyone:F guest_ok=y
I give 777 permissions to the folder:
$ sudo chmod 0777 /home/developer/documents
And then I check what I've done
$ sudo net usershare info --long
When I want to see if the folder is visible from all windows machine, you can see. However, you cann't access that folder and get error of: "Permission Denied"
The message in: /var/log/samba/log.ip-domain is:
process_usershare_file: stat of /var/lib/samba/usershares/backuparsac failed. Permission denied
Then, I try to add some rules to my smb.conf
[documents]
comment = Documents for Developers
path = /home/developer/documents
browseable = yes
writable = yes
read only = yes
guest ok = yes
directory mask = 0777
but the error of Permission denied keeps coming. Is there anything else I need to do? I need this folder can be accessed by all windows machines.
NOTE: I use Ubuntu 14.04
The cause is that Samba does not synchronize its users with the system.
This solved the issue in my case, on Kubuntu 14.10:
sudo apt-get install libpam-smbpass
sudo service samba restart
If you don't want to synchronize users with PAM, simply add a user to Samba's password database:
sudo smbpasswd -a <user>
After that, the user will be able to open shared folders on the Samba machine.
Your configuration file seems to be fine.
I reckon there might be a permission issue in your parent folder.
I suggest you check /home and /home/developer both have 755 rather than 750 permission.
Then check sudo -u nobody ls /home/developer/documents.
If ls is successful, the samba is likely to work as you expected as well

Permissions issue on cifs mount between Ubuntu and Mavericks

On my Linux box running Ubuntu 12.04LTS I am able to mount a share using cifs.
The shared folder in question is located at a Mac Pro running Mavericks.
Here is the fstab on the Ubuntu/Linux box.
//132.13.6.5/Data /home/sro/Mount cifs username=sro,password=psw,nounix,sec=ntlmssp,rw
/Mount on the Linux box has these permissions:
drwxr-xr-x 21 root root 0 Jan 16 13:29 Mount
I can read /Mount/Data but not write (I get a permission error).
I think this is because /Mount is created by root and I am trying this a user.
But I am unable to change /Mount permissions or ownership even using sudo.
On the Mac/Mavericks side, /Data has read/write permissions.
Any ideas how to solve this?
The issue here was a missing UID/GID pair. Apparently when those are absent the default owner of the share will be root.
So my fstab line should look like this:
//132.13.6.5/Data /home/sro/Mount cifs username=sro,password=psw,nounix,sec=ntlmssp,rw,uid=1001,gid=1001
Two things:
your UID/GID may not be 1001 so better check with the id command first
you may want to use permission masks as detailed here.
add to your fstab line uid=your_user_name your line will be:
//132.13.6.5/Data /home/sro/Mount cifs username=sro,password=psw,nounix,sec=ntlmssp,rw,uid=your_user_name
That way you are asking linux to set that user as owner of filesystem being mounted.

virtual centOS 6.2 - How to share /var/www using Samba

I have Windows XP, installed VirtualBox, and have now a centOS virtual machine.
I am sharing folders between the two machines using Samba.
I have successfully accessed shared folders in the Home directory.
My problem now is how do I access /var/www? (I have exactly the same setting with home directories in smb.conf except path).
Thanks in advance.
You must add such section to the smb.conf:
[www]
comment = Web Root Dir
path = /var/www
valid users = user
public = no
writable = yes
printable = no
User user must exist in the system and in Samba (added by smbpasswd -a user). Of course you can use other username.
Check if your user user can access this filesystem in Linux (without samba). If it can't you must give him access rights in Linux.

Newly created folder permission rights issue

Hope you are good. I have Xammp on fedora and changed owner of opp/lampp/htdoc to root. Why I did so because whenever someone creates new folder through sharing, they don't have permission to dynamically create folder or files or to write images. Then I run command
chmod -R 777 /opt/lampp/htdocs
But when system goes to restart then I again need to run this command. So avoid again and again run this command I changed the owner on "opt/lampp/htdocs" and run
chmod -R 777 /opt/lampp/htdocs
Now, whenever server restarts, assigned permissions don't need to be set again and again. That is resolved.
I have an issue, that old directories can be used to write something. But if any network user creates new directory under htdocs, that new directory needs to be changed the permission for it.
previously created, and can use this one directory to run script to create files
drwxrwxrwx 2 root root 4096 2011-06-15 14:09 aaa
Newly created, cannot be used to run a script to create image or to write anything
drwxr-xr-x 2 root root 4096 2011-06-17 15:17 aaaa
drwxr-xr-x this one is really annoying to me for each newly created folder in htdocs :(
Just to let you know that my htdocs user and rights are:
drwxrwxrwx 101 root root 4096 2011-06-17 15:17 htdocs
Why is it so? Can anybody please help me to figure this problem out? I am waiting for quick response anxiously.
First off, you should investigate what permissions you really need - chmodding everything to 777 is a security risk as it will allow any user to write inside of your web root.
However, to address your actual question of the default permissions when a new folder is created by a user, you want to adjust the default "umask" which determines such things.
This question has some information for changing it for the Apache user (if a "network user" is a user creating new files and directories through the httpd process):
Setting the umask of the Apache user
If you need to adjust it for other users or processes, the solution will be similar.
Good luck!
Edit
Since you're on Fedora, try this: (from the question I linked above)
[root ~]$ echo "umask 002" >> /etc/sysconfig/httpd
[root ~]$ service httpd restart
The first command will add that line to the /etc/sysconfig/httpd which is a permanent configuration file, and the second command will make it active.
You are tackling the problem from the wrong side. Restore your apache configuration to use apache.apache as default user/group, and set your samba server to use those credentials when someone write to your document root.
If you are using nfs or another posix compatible filesystem, use chmod g+s to keep all files readable from your apache server.
Try it:
#umask 000
have a good time!!

Resources