LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 11-23-2012, 07:29 PM   #1
Basso84
LQ Newbie
 
Registered: Nov 2012
Posts: 4

Rep: Reputation: Disabled
Two strange samba sharing problems


Hi. I apologize my bad english. Hope you understand. I have raspberry pi with debian wheezy.

My first problem is: (THIS PROBLEM SOLVED. To see how, look down)

Samba user seems like to be "other" user. I have done system user with adduser and samba user smbpasswd. Then chmod 775 /home/basso. Then i checked ls -ld /home/basso and i got drwxrwxrwx 2 root Share 4096.
Then i make connection in windows7 and i am able to login there and read files but not write. When i change chmod 777 /home/basso, i am able to write also. So seems like it works because i must use name/password in login but i cant write without chmod 777. Something strange happens here.

Some of my samba share config:

Security = user
workgroup = WORKGROUP (windows too)
encrypt passwords = yes
unix password sync = yes
map to guest = bad user
usershare allow guests = yes

[homes]
comment = Home Directories
browseable = no
create mask = 0775
directory mask = 0775
valid users = %S
; comment = Network Logon Service
; path = /home/samba/netlogon
; guest ok = yes
; read only = yes
; comment = Users profiles
; path = /home/samba/profiles
; guest ok = no
; browseable = no
; create mask = 0600
; directory mask = 0700

[basso]
path = /home/basso
valid users = Basso
read only = no
browseable = no
public = no
writeable = yes
guest ok = no
writeable = yes
guest ok = no

I paste my testparm too:

Processing section "[homes]"
Processing section "[printers]"
Processing section "[print$]"
Processing section "[basso]"
Processing section "[usb]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
server string = %h server
map to guest = Bad User
obey pam restrictions = Yes
pam password change = Yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
unix password sync = Yes
syslog = 0
log file = /var/log/samba/log.%m
max log size = 1000
dns proxy = No
usershare allow guests = Yes
panic action = /usr/share/samba/panic-action %d
idmap config * : backend = tdb

[homes]
comment = Home Directories
valid users = %S
read only = No
create mask = 0775
directory mask = 0775
browseable = No

[printers]
comment = All Printers
path = /var/spool/samba
create mask = 0700
printable = Yes
print ok = Yes
browseable = No

[print$]
comment = Printer Drivers
path = /var/lib/samba/printers


[basso]
path = /home/basso
valid users = Basso
read only = No
browseable = No


[usb]
path = /mnt/disk2
valid users = Basso
read only = No
create mask = 0777
directory mask = 0777
guest ok = Yes

My second problem is usb stick write enabling. I have usb memory which is FAT32. There problem is that i can read and execute but not write at all. chmod not even change anything. i wrote chmod 777 /mnt/disk2 and ls -ld /mnt/disk2 says drwxr-xr-x 2 root root 4096 tammi 1 1970 /mnt/disk2

I hope someone knows what the hell i am doing wrong. Thanks!

Edit: With chmod 777 i can do all. With 775 i can read and 771-774 and 776 i can't even log in

Edit: First problem solved. I did groups and added users to groups. Then force group to smb.conf. I also used
sudo groupadd group1
sudo usermod -G group1 Basso
sudo chown -R root:group1 /home/basso
sudo chmod -R 770 /home/basso

Now i can set "others" to 0 and that is enough. Usb problem not solved yet

Edit: Now both problems solved. I did the same thing to usb disk. It blocked me to chance /mnt/disk2 permissions. Don't know why. So i did disk1 and used sudo chown -R root:group1 /mnt/disk1 and sudo chmod -R 770 /mnt/disk1 and now it is working. And now my usb share looks like this:

[usb]
path = /mnt/disk1
valid users = Basso
read only = no
browseable = yes
public = no
writeable = yes
guest ok = no
force group = group1

PROBLEM SOLVED.

Last edited by Basso84; 11-24-2012 at 05:40 PM. Reason: Both problems solved
 
Old 11-25-2012, 10:41 PM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
You can't change permissions on a FAT32 filesystem. Instead use mount options to set the owner and permissions when it is mounted. You don't need to change permissions of the device. Use the UUID=<uuid> for the device name in /etc/fstab because the particular device (e.g. /dev/sdb1) could change for a removable drive.

Check /etc/passwd and your smbpasswd command. Don't use Basso if your user name is basso. It looks like you are granting others permissions instead to gain write access. Resort to the samba logs when troubleshooting.
 
Old 11-26-2012, 08:02 AM   #3
Basso84
LQ Newbie
 
Registered: Nov 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jschiwal View Post
You can't change permissions on a FAT32 filesystem. Instead use mount options to set the owner and permissions when it is mounted. You don't need to change permissions of the device. Use the UUID=<uuid> for the device name in /etc/fstab because the particular device (e.g. /dev/sdb1) could change for a removable drive.

Check /etc/passwd and your smbpasswd command. Don't use Basso if your user name is basso. It looks like you are granting others permissions instead to gain write access. Resort to the samba logs when troubleshooting.
Actually i noticed same thing. Usb stick showed 14Gb which is my SD card. Then i did actually that thing which you adviced and now my 4Gb usb stick is in use. But i used this command: sudo mount -t vfat -o rw,users /dev/sda1 /mnt/disk1 but i don't know yet how to put this tu fstab. I need use that command everytime i boot my debian. Can you tell me hot to do this?

And my username is Basso, home folder is basso and usb share is disk1

Thanks!
 
Old 11-29-2012, 08:59 AM   #4
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
Assuming the UUID of the USB stick's file system is 866E-E1E1
Code:
UUID=866E-E1E1  /mnt/disk vfat rw,nosuid,nodev,uid=Basso,gid=Basso,dmask=0077,fmask=0177,utf8=1,noauto,flush,noatime 0 0
I assumed Basso is your default group for gid=. nosuid and nodev are for security on mass storage devices. Consider no exec option as well. No auto is needed to prevent booting failure is the USB stick isn't plugged in. You could use nofail instead. The 'owner's option will let you mount the pen drive without needing to use sudo.

With these permissions, only user Basso can read files on the pen drive on that computer.

I used the uuid number, so it will boot even if a different device node is used the next time.
 
Old 11-30-2012, 05:55 AM   #5
Basso84
LQ Newbie
 
Registered: Nov 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks for code but there is problem. With that code usb stick shows at 14Gb. Real size is 4Gb. With this code with manual use sudo mount -t vfat -o rw,users /dev/sda1 /mnt/disk1 it works but with your code, size is wrong. Little more info:

User = Basso
Group where Basso belongs = admini
sudo blkid /dev/sda1 tells me = /dev/sda1: UUID="2451-2E60" TYPE="vfat"

And i tried that your code to fstab

Last edited by Basso84; 11-30-2012 at 06:37 AM.
 
Old 12-02-2012, 06:47 AM   #6
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
It sounds like the file system is corrupt. You should back up the files on it and reparation and reformat it.
 
Old 12-05-2012, 09:13 AM   #7
Basso84
LQ Newbie
 
Registered: Nov 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jschiwal View Post
It sounds like the file system is corrupt. You should back up the files on it and reparation and reformat it.
Ok. I try that and then do that again and hope it works. Thanks for help!
 
  


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
Samba/Cups print sharing problems (/var/spool/samba files) Gates1026 Linux - General 9 06-23-2013 02:33 AM
sharing internet but samba doesnt work, turn filewall off samba works but net isnt Jungle_King Linux - Networking 2 05-08-2009 08:00 AM
Problems sharing files between XP and Linux via Samba bmccorm2 Linux - Networking 5 08-28-2006 08:35 PM
Problems sharing the printer on Linux via Samba to Windows computers melao Suse/Novell 25 03-22-2005 10:37 AM
internet sharing & samba problems pelgrimforever Linux - Networking 82 08-29-2004 06:48 PM


All times are GMT -5. The time now is 07:30 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration