Giving acces to usb harddrive

Hi.
I have an USB drive and I made a share with samba and accessed it from windows computer.
I’ve been using openSUSE 11.3 with no problems.

Recently, I’ve installed openSUSE 11.4. Now I can’t write to my USB Disk through samba.

It is formatted as ntfs.

samba log tells a lot of things… for eg.:

[2011/05/30 11:46:54.148085,  2] smbd/trans2.c:5531(smb_set_file_dosmode)
  smb_set_file_dosmode: file_set_dosmode of 1 failed (Permission denied)
[2011/05/30 11:46:54.148163,  3] smbd/error.c:80(error_packet_set)
  error packet at smbd/trans2.c(7759) cmd=50 (SMBtrans2) NT_STATUS_ACCESS_DENIED
[2011/05/30 11:46:54.154426,  3] smbd/process.c:1485(process_smb)
  Transaction 203 of length 45 (0 toread)
[2011/05/30 11:46:54.154572,  3] smbd/process.c:1294(switch_message)
  switch message SMBclose (pid 15374) conn 0xb77b6e00
[2011/05/30 11:46:54.154638,  3] smbd/reply.c:4653(reply_close)
  close fd=-1 fnum=12766 (numopen=1)
[2011/05/30 11:46:54.154750,  2] smbd/close.c:656(close_normal_file)
  root closed file 1 (numopen=0) NT_STATUS_OK

Tried to set NTFS access from Windows PC. It doesn’t work.
Tried to change options in fstab:

/dev/disk/by-id/usb-StoreJet_TS120GSJ25T-S_404812FF-0:0-part1 /media/USBHDD        ntfs-3g    defaults,locale=en_US.UTF-8 0 0

I can write to USB HardDrive from SUSE with no su privileges. But I stil can’t write to it through samba.

Any ideas?

Thanks a lot!

The mount defines root ownership which likely is in conflict with the samba permissions as contained in the file smb.conf.

  1. Please post a copy of the file here so I can check Samba permissions. Run this command: cat /etc/samba/smb.conf
  2. Please post results of next command here so I can cross check with above. Run this command (while drive is mounted): ls -l /media | grep USB

Thanks for reply!

1:


[global]
        workgroup = WORKGROUP
        netbios name = LS00006
#       passdb backend = smbpasswd
#       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:
        security = share
#       usershare allow guests = Yes
        guest account = smbanon
#       guest account = root
        log level = 3
        ldap suffix = 
        wins server = 
        wins support = No

[h]
        comment = USD
        path = /media/USBHDD/
        read only = No
        browseable = Yes
        guest ok = Yes
        writable = Yes

[temp]
        comment = temp
        path = /home/rusart/temp
        guest ok = Yes
        browsable = Yes
        read only = No

[r]
        comment = test
        path = /media/36BA-C65A
        guest ok = Yes
        browsable = Yes

2:

rusart@L000006:/media>         ls -l /media | grep USB
drwxrwxrwx 1 root root 12288 May 30 12:00 USBHDD

I don’t know how smbanon and security = share mix in with a root share. But I can suggest what should work. You should keep a copy of the old smb.conf and make a new one using this:

[global]
        workgroup = WORKGROUP
        netbios name = LS00006
name resolve order = bcast host lmhosts wins
local master = auto
preferred master = auto
os level = 32
#       passdb backend = smbpasswd
#       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:
 security = user
#       usershare allow guests = Yes
#       guest account = smbanon
#       guest account = root
        log level = 3
#        ldap suffix = 
#        wins server = 
#        wins support = No

[h]
        comment = USD
        path = /media/USBHDD/
        read only = No
#        browseable = Yes
        guest ok = Yes
#        writable = Yes
force user = rusart

[temp]
        comment = temp
        path = /home/rusart/temp
        guest ok = Yes
        browsable = Yes
        read only = No

[r]
        comment = test
        path = /media/36BA-C65A
        guest ok = Yes
        browsable = Yes

And change the mount code in fstab to be this:

/dev/disk/by-id/usb-StoreJet_TS120GSJ25T-S_404812FF-0:0-part1 /media/USBHDD        ntfs-3g    defaults,uid=rusart,gid=users,locale=en_US.UTF-8 0 0

That would match most everything up OK I hope

I’m assuming that your username is rusart.

fstab changed
smb.conf changed

after remounting…

The same result…


# ls -l /media/ | grep US
drwxrwxrwx 1 rusart users 12288 May 30 12:00 USBHDD


# mount | grep USB
/dev/sdc1 on /media/USBHDD type fuseblk (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)


That’s correct.

Oh and another thing just to mind, there’s a bug in Samba daemon in 11.4, that might cause a problem, check it’s not active, run this command and report back:

su - -c "rcnmb status;rcsmb status"

(ps there are two minuses in there, it’s not a typo)


> su - -c "rcnmb status;rcsmb status"
Password: 
Checking for Samba NMB daemon                                                                                                                            unused
Checking for Samba SMB daemon                                                                                                                            running

starting of NMB does nothing :slight_smile:

You’ve been hit by the bug. Go to Yast -->Novell AppArmor → AppArmor Control Panel → Set Profile Modes → Configure → highlight usr.sbin.smbd and “Toggle” to read “complain”. Do that also for usr.sbin.nmbd. Lock that in (Done → Done etcr).

Next go to Yast → system → system services runlevels and find nmb and smb and make sure they’re set to running=yes. If not, then toggle them to on with Enable button.

After, reboot.

I’ve assumed from your experience with 11.3 that you know how to set SuSEfirewall2 and have done that.

I’ve already had problem with AppArmor and thought I’ve switched it off!!! :slight_smile:
I’ve done as you told (Togle to complain mode) and set runlevels for smb (it was on) and nmb (it was Off).
And NOW I’m able to write to my mounted USB HDD!!!

Can I just turn AppArmor off somehow? to avoid problems in future?) or this is not good idea?

swerdna, Thank you very very much!

When you first open AppArmor Control Panel, there’s an X in a box labeled “enable apparmor”. Un-check the box and it will be turned off.

Thank you a lot :slight_smile:
I thought I turned it off :)) May be it turned on after system update…

Thanks again!