Samba to Win7 - Help!

Hi everyone im new here and am in need of some help.
Im trying to setup samba so that i can copy some files from my windows 7 machine over to the drive on the opensuse machine running 11.2. i believe i set everything how it should be set up but no matter what i do i cant write filesfrom the windows machine.

Here is my smb.conf

smb.conf is the main Samba configuration file. You find a full commented

version at /usr/share/doc/packages/samba/examples/smb.conf.SUSE if the

samba-doc package is installed.

Date: 2009-10-27

[global]
workgroup = JCHOUSEHOLD
netbios name = JC-BckupSrv
name resolve order = bcast host lmhhost wins
passdb backend = tdbsam
printing = cups
printcap name = cups
printcap cache time = 750
cups options = raw
map to guest = Bad User
include = /etc/samba/dhcp.conf
#logon path = \%L\profiles.msprofile
#logon home = \%L%U.9xprofile
#logon drive = P:
usershare allow guests = Yes
usershare max shares = 100
usershare owner only = False
wins support = No
security = user

Share disabled by YaST

[homes]

comment = Home Directories

valid users = %S, %D%w%S

browseable = No

read only = No

inherit acls = Yes

[profiles]

comment = Network Profiles Service

path = %H

read only = No

store dos attributes = Yes

create mask = 0600

directory mask = 0700

Share disabled by YaST

[users]

comment = All users

path = /home

read only = No

inherit acls = Yes

veto files = /aquota.user/groups/shares/

Share disabled by YaST

[groups]

comment = All groups

path = /home/groups

read only = No

inherit acls = Yes

Share disabled by YaST

[printers]

comment = All Printers

path = /var/tmp

printable = Yes

create mask = 0600

browseable = No

Share disabled by YaST

[print$]

comment = Printer Drivers

path = /var/lib/samba/drivers

write list = @ntadmin root

force group = ntadmin

create mask = 0664

directory mask = 0775

[Bckups]
comment = Bckup-Srv
path = /Windows7
read only = No
writeable = Yes
guest ok = yes
available = yes
public = yes
browsable = yes

Check out@swerdna
openSUSE SuSE Linux HOWTOs and Tutorials by Swerdna

I don’t understand the nature of the problem. You’ve given inadequate detail. Let me try to interpret what you said: Is it that you can see the windows 7 computer in your network browser called Dolphin and you can click the icon for the windows 7 computer and then drill down in Dolphin and see the icon for the share on the windows 7 machine and when you click that icon you get an error message? Is that it?

sorry for not being clear.
I have a machine running opensuse 11.2 gnome (so its nautilus) and on it i placed a second drive which i want to use to backup my data from my windows 7 machine. the issue is that i can see the folders and drill down into it however no matter what i do on the opensuse side i can’t seem to write anything into the drive from the windows side. it says i dont have write permissions.

Also i cant seem to edit my original post…

You’re right, it’s a permissions problem. I suspect that you’ve mounted an NTFS drive/partition into the directory /windows7. If it’s an NTFS partition then it’s likely that it’s mounted to allow only the Linux root user to write into it. So that would need to be changed (if I’m correct that it’s been mounted as root-only write access). But it might be a Linux partition and not NTFS.

Based on your stanza for [Bckups] in smb.conf, I think that you want simple write access for any user on the LAN to the directory /windows7. There are several ways to do that, here’s one of them:

You can arrange for all the files and directories in /windows7 to belong to a non-root Linux user e.g. timothy and to be readable and writable by everyone on the computer and everyone on the LAN. Let me know if you want it to be more restrictive.

Change the smb.conf stanza to this form:

[Bckups]
comment = Bckup-Srv
path = /Windows7
read only = No
guest ok = yes
force user = timothy

I’ll use timothy as your Linux username. Change it to your correct username in what I write.

OK, that’s the Samba side of the permissions fixed. Now for the Linux side of the permissions. This is handled differently if the partition is NTFS or Linux filesystem (e.g. ext3, ext4 etc).

Possibility one: the drive partition is not an NTFS partition
Run these two commands from a terminal window:

  • sudo chown -R timothy:users /Windows7
  • sudo chmod -R 755 /Windows7

Now all the contents, old or new, in the directory will be owned by timothy – this is a tidy thing from a Linux administrative standpoint.

Possibility two: the drive partition is an NTFS partition
In this case change the mount by editing it in the file that controls how drives are mounted. The file is “fstab” at /etc/fstab. You can look at it and/or edit it with this command run from a terminal:

gnomesu gedit /etc/fstab

There’ll be a line there for the NTFS drive sort of like this one from my computer:

/dev/etc_etc /Windows7 ntfs-3g users,gid=users,fmask=133,dmask=022,locale=en_GB.UTF-8 0 0

You edit only this string from the line:

users,gid=users,fmask=133,dmask=022,locale=en_GB.UTF-8

and change it to this form:

uid=timothy,gid=users,umask=0022

so that the line ends up like this:

/dev/etc_etc /Windows7 ntfs-3g uid=timothy,gid=users,umask=0022 0 0

After that a reboot will change the permissions and ownership to timothy. FYI this ownership is only an artifice that holds for Linux. If you take the drive out and stick it in a windows computer, the ownerships revert conveniently and automagically correctly to a windows form.

Try that – simple isn’t it lol!

References:
HowTo Mount NTFS Filesystem Partition Read Write Access in openSUSE
Samba HowTo Configure a Professional File Server on a SOHO LAN
Notes on chown and chmod

There’s one caveat. If this piece"locale=en_GB.UTF-8" is different for you in fstab, let me know.

I’m not sure of the time available before it shuts off (locks), maybe 10 minutes or there abouts.

um actually the drive mounted as /Windows7 is a FAT32.
Does all this still apply?

Yes except the detail is marginally different. Paste here the line from fstab and I’ll tell you what to put in its place.

Reference: openSUSE: HowTo set disk access permissions for Fat32 (VFAT) on a desktop PC

This is the fstab file:
thanks for all the help, there’s so much to learn…

/dev/disk/by-id/ata-Maxtor_5T020H2_T2JAQYDC-part5 swap swap defaults 0 0
/dev/disk/by-id/ata-Maxtor_5T020H2_T2JAQYDC-part1 / ext4 acl,user_xattr 1 1
/dev/disk/by-id/ata-Maxtor_5T020H2_T2JAQYDC-part3 /home ext4 acl,user_xattr 1 2
proc /proc proc defaults 0 0
sysfs /sys sysfs noauto 0 0
debugfs /sys/kernel/debug debugfs noauto 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
/dev/disk/by-id/ata-ST3160815A_9RA1E7D5-part1 /Windows7/Bckups vfat users,gid=users,umask=0002,utf8=true 0 0

Change it to this:
/dev/disk/by-id/ata-ST3160815A_9RA1E7D5-part1 /Windows7 vfat uid=timothy,gid=users,utf8 0 0

Notice I’ve also changed the mount directory to be /Windows7, consistent with everything else. You can ignore (or delete) the subdirectory Bckups (or you can change every other instance of /Windows7 to /Windows7/Bckups – just be consistent).

I tried running this command but when i run it, it gives me the error:
chown: changing ownership of `/Windows7/Bckups’: Operation not permitted

The chown and chmod thing was for a Linux filesystem. You have a non-Linux filesystem so you ignore “Possibility one” and go with the “Possibility two” version where you change the entry in fstab. But of course, use the FAT32 code I gave you, not the NTFS code.

Oh i see.
I did everything that you told me and when i restarted i tried to copy some files over from my windows machine and it still doesn’t let me. I dont know what i did wrong or if something else is wrong…

OK let’s gather some diagnostic information. Please run these commands and copy the info here:

  • cat /etc/fstab
  • cat /etc/samba/smb.conf
  • ls -l /Windows7
  • ls -l /Windows7/Bckups
  • smbtree -N
  • users

cat /etc/fstab:
/dev/disk/by-id/ata-Maxtor_5T020H2_T2JAQYDC-part5 swap swap defaults 0 0
/dev/disk/by-id/ata-Maxtor_5T020H2_T2JAQYDC-part1 / ext4 acl,user_xattr 1 1
/dev/disk/by-id/ata-Maxtor_5T020H2_T2JAQYDC-part3 /home ext4 acl,user_xattr 1 2
proc /proc proc defaults 0 0
sysfs /sys sysfs noauto 0 0
debugfs /sys/kernel/debug debugfs noauto 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
/dev/disk/by-id/ata-ST3160815A_9RA1E7D5-part1 /Windows7 vfat uid=kokoru,gid=users,utf8 0 0

cat /etc/samba/smb.conf:

smb.conf is the main Samba configuration file. You find a full commented

version at /usr/share/doc/packages/samba/examples/smb.conf.SUSE if the

samba-doc package is installed.

Date: 2009-10-27

[global]
workgroup = JCHOUSEHOLD
netbios name = JC-BckupSrv
name resolve order = bcast host lmhhost wins
passdb backend = tdbsam
printing = cups
printcap name = cups
printcap cache time = 750
cups options = raw
map to guest = Bad User
include = /etc/samba/dhcp.conf
#logon path = \%L\profiles.msprofile
#logon home = \%L%U.9xprofile
#logon drive = P:
usershare allow guests = Yes
usershare max shares = 100
usershare owner only = False
wins support = No

Share disabled by YaST

[homes]

comment = Home Directories

valid users = %S, %D%w%S

browseable = No

read only = No

inherit acls = Yes

[profiles]

comment = Network Profiles Service

path = %H

read only = No

store dos attributes = Yes

create mask = 0600

directory mask = 0700

Share disabled by YaST

[users]

comment = All users

path = /home

read only = No

inherit acls = Yes

veto files = /aquota.user/groups/shares/

Share disabled by YaST

[groups]

comment = All groups

path = /home/groups

read only = No

inherit acls = Yes

Share disabled by YaST

[printers]

comment = All Printers

path = /var/tmp

printable = Yes

create mask = 0600

browseable = No

Share disabled by YaST

[print$]

comment = Printer Drivers

path = /var/lib/samba/drivers

write list = @ntadmin root

force group = ntadmin

create mask = 0664

directory mask = 0775

[Bckups]
[Bckups]
comment = Bckup-Srv
path = /Windows7
read only = No
guest ok = yes
force user = kokoru

ls -l /Windows7:
total 16
drwxr-xr-x 2 kokoru users 16384 2010-05-17 05:43 Bckups

ls -l /Windows7/Bckups:
total 0

smbtree -N:
JCHOUSEHOLD
\NAARA Captain’s Desk
\NAARA\prnproc$ Printer Drivers
\NAARA\print$ Printer Drivers
\NAARA\Percy Jackson & The Olympians
\NAARA\My Pictures
\NAARA\IPC$ Remote IPC
\NAARA\HP Officejet 6300 series fax HP Officejet 6300 series fax
\NAARA\HP Officejet 6300 series HP Officejet 6300 series
\NAARA\F$ Default share
\NAARA\E$ Default share
\NAARA\C$ Default share
\NAARA\ADMIN$ Remote Admin
\JC-BCKUPSRV Samba 3.4.3-3.3.1-2341-SUSE-SL11.2
\JC-BCKUPSRV\windows7
\JC-BCKUPSRV\IPC$ IPC Service (Samba 3.4.3-3.3.1-2341-SUSE-SL11.2)
\JC JC
\JC\C$ Default share
\JC\Jael’s Documents
\JC\ADMIN$ Remote Admin
\JC\Printer2 Microsoft XPS Document Writer
\JC\Admin
\JC\Printer3 Microsoft Office Document Image Writer
\JC\Jacky’s Documents
\JC\print$ Printer Drivers
\JC\D$ Default share
\JC\IPC$ Remote IPC
\JC\E$ Default share

users:
root root

I see two problems remaining:

  1. this stanza has an extra line:
[Bckups]
[Bckups]
comment = Bckup-Srv
path = /Windows7
read only = No
guest ok = yes
force user = kokoru

Delete one of the lines [Bckups] so there’s only one

  1. you are logging in as root user. You should avoid that strenuously and only do that in emergencies. For most issues you can log on as kokoru and perform tasks by switchihg to superuser (with root powers) when necessary.

After you change the stanza and delete the duplicate line, reboot and try again.

Oh ok i wont use root unless necessary.
However now everytime i try to acess the shares from the windows side i get asked for a password and username.

That’s really strange; maybe it has to do with your unconventional [global] stanza. But to end it quickly, add a username and password to samba database and then use those credentials from windows 7. Run this command and follow the prompts:

sudo smbpasswd -a kokoru

then use those data from windows.

Nothing i put those credentials in and it gives me an error saying that i dont have permission to access it.