LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-03-2010, 04:34 AM   #1
spikesync
LQ Newbie
 
Registered: Jan 2010
Posts: 13

Rep: Reputation: 0
Read-Only Shared file from Ubuntu


Hi everybody! I need your help. I have encounter problem about opening a file sharing. The situation goes like this.....

1. A folder and file from ubuntu has a both permission to write,read and execute to a specific user which is i added in a group.
2. When i open a file from ubuntu to my Windows Computer i can edit and save and then close the file. But when i open it again the file and edit then save the problem goes to Read-Only I cannot save the file.
3. When I check again the folder and file permission to read, write and execute and then I can access the file again edit and save.

What are the probable cause of this problem to Windows? Ubuntu to Ubuntu there is no problem accessing and saving a file.

Please need your help. Thanks in advance!
 
Old 02-03-2010, 04:46 AM   #2
amon
Member
 
Registered: May 2004
Location: UK
Distribution: Debian, Ubantu, CentOS
Posts: 146

Rep: Reputation: 17
You need to let us know:

what file system the file is on.

What file sharing system/protocol you are using (samba/nfs etc...)
 
Old 02-03-2010, 04:58 AM   #3
spikesync
LQ Newbie
 
Registered: Jan 2010
Posts: 13

Original Poster
Rep: Reputation: 0
Im using samba for file sharing. The file I want to edit and save is QPRO file.

Thanks for the reply!
 
Old 02-03-2010, 05:16 AM   #4
amon
Member
 
Registered: May 2004
Location: UK
Distribution: Debian, Ubantu, CentOS
Posts: 146

Rep: Reputation: 17
Quote:
Originally Posted by spikesync View Post
Im using samba for file sharing. The file I want to edit and save is QPRO file.

Thanks for the reply!
When you are working with file shares and samba you have two sets of file permissions to worry about.
  1. The samba permissions. More info is available in samba documentation and this article:Samba share permissions simplified
  2. The local file system permissions. These are covered in lots of places like this article: Linux Files and File Permission

Make sure that the two are providing you with what you want and remember to keep it simple. Sometimes (if you are in a safe local network) it is easiest to give simple "read/write all" access to everyone and then slowly nail it down.

At the command line go to the shared directory and run this to display the files and their permissions:
Code:
ls -lh
Check your documentation for samba configuration file locations if you feel you need to show them.

On a side note, when it comes to this sort of thing I find it easier to work with simple text files... But that's just my command line junky nature speaking.
 
Old 02-03-2010, 05:22 AM   #5
spikesync
LQ Newbie
 
Registered: Jan 2010
Posts: 13

Original Poster
Rep: Reputation: 0
Amon thanks for the information... I will try this. Again Thanks.
 
Old 02-04-2010, 02:57 AM   #6
spikesync
LQ Newbie
 
Registered: Jan 2010
Posts: 13

Original Poster
Rep: Reputation: 0
@ Amon: Hi! Its the same problem again. Ive noticed that the shared file from Ubuntu Server which is the default Owner and Group is USERS and shared to Ubuntu Desktop Client and Windows Client have permission to read,write and execute using Access Control List to a specific users. When Ubuntu Desktop Client users access that file and modify it, it is ok but when i look the file permission on Ubuntu Server the Owner and Group of that file is not USERS which is the default it is the Ubuntu Desktop Client that's why Windows Clients users got read-only when opening that shared file which is modified by Ubuntu Desktop Client users. But Ubuntu to Ubuntu is not a problem accessing shared file even though the Owner and Group may changed. The problem is on the Windows Client access that shared file.

Is their any ways to fixed the owner and group on a shared file even more users to modify that file?
 
Old 02-04-2010, 11:04 AM   #7
amon
Member
 
Registered: May 2004
Location: UK
Distribution: Debian, Ubantu, CentOS
Posts: 146

Rep: Reputation: 17
Can I ask again for you to post your samba configuration for the network shares and also the output to 'ls -lh' on the directory where the file is shared from.

Are you sure that the clients are connecting as the same users?
 
Old 02-04-2010, 09:25 PM   #8
spikesync
LQ Newbie
 
Registered: Jan 2010
Posts: 13

Original Poster
Rep: Reputation: 0
Hi amon! here's my smb.confg and below the output of ls -lh. If you modify the smb.confg I appreciate that. Thanks a lot.



# Sample configuration file for the Samba suite for Debian GNU/Linux.
#
#
# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options most of which
# are not shown in this example
#
# Some options that are often worth tuning have been included as
# commented-out examples in this file.
# - When such options are commented with ";", the proposed setting
# differs from the default Samba behaviour
# - When commented with "#", the proposed setting is the default
# behaviour of Samba but the option is considered important
# enough to be mentioned here
#
# NOTE: Whenever you modify this file you should run the command
# "testparm" to check that you have not made any basic syntactic
# errors.
# A well-established practice is to name the original file
# "smb.conf.master" and create the "real" config file with
# testparm -s smb.conf.master >smb.conf
# This minimizes the size of the really used smb.conf file
# which, according to the Samba Team, impacts performance
# However, use this with caution if your smb.conf file contains nested
# "include" statements. See Debian bug #483187 for a case
# where using a master file is not a good idea.
#

#======================= Global Settings =======================

[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup = WORKGROUP

# server string is the equivalent of the NT Description field
server string = %h server (Samba, Ubuntu)

# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable its WINS Server
# wins support = no

# WINS Server - Tells the NMBD components of Samba to be a WINS Client
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
; wins server = w.x.y.z

# This will prevent nmbd to search for NetBIOS names through DNS.
dns proxy = no

# What naming service and in what order should we use to resolve host names
# to IP addresses
; name resolve order = lmhosts host wins bcast

#### Networking ####

# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
; interfaces = 127.0.0.0/8 eth0

# Only bind to the named interfaces and/or networks; you must use the
# 'interfaces' option above to use this.
# It is recommended that you enable this feature if your Samba machine is
# not protected by a firewall or is a firewall itself. However, this
# option cannot handle dynamic or non-broadcast interfaces correctly.
; bind interfaces only = yes



#### Debugging/Accounting ####

# This tells Samba to use a separate log file for each machine
# that connects
log file = /var/log/samba/log.%m

# Cap the size of the individual log files (in KiB).
max log size = 1000

# If you want Samba to only log through syslog then set the following
# parameter to 'yes'.
# syslog only = no

# We want Samba to log a minimum amount of information to syslog. Everything
# should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
# through syslog you should set the following parameter to something higher.
syslog = 0

# Do something sensible when Samba crashes: mail the admin a backtrace
panic action = /usr/share/samba/panic-action %d


####### Authentication #######

# "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
# in the samba-doc package for details.
# security = user
username map = /etc/samba/smbusers

# You may wish to use password encryption. See the section on
# 'encrypt passwords' in the smb.conf(5) manpage before enabling.
encrypt passwords = true

# If you are using encrypted passwords, Samba will need to know what
# password database type you are using.
passdb backend = tdbsam

obey pam restrictions = yes

# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.
unix password sync = yes

# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan <<kahan@informatik.tu-muenchen.de> for
# sending the correct chat script for the passwd program in Debian Sarge).
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

# This boolean controls whether PAM will be used for password changes
# when requested by an SMB client instead of the program listed in
# 'passwd program'. The default is 'no'.
pam password change = yes

# This option controls how unsuccessful authentication attempts are mapped
# to anonymous connections
map to guest = bad user

########## Domains ###########

# Is this machine able to authenticate users. Both PDC and BDC
# must have this setting enabled. If you are the BDC you must
# change the 'domain master' setting to no
#
; domain logons = yes
#
# The following setting only takes effect if 'domain logons' is set
# It specifies the location of the user's profile directory
# from the client point of view)
# The following required a [profiles] share to be setup on the
# samba server (see below)
; logon path = \\%N\profiles\%U
# Another common choice is storing the profile in the user's home directory
# (this is Samba's default)
# logon path = \\%N\%U\profile

# The following setting only takes effect if 'domain logons' is set
# It specifies the location of a user's home directory (from the client
# point of view)
; logon drive = H:
# logon home = \\%N\%U

# The following setting only takes effect if 'domain logons' is set
# It specifies the script to run during logon. The script must be stored
# in the [netlogon] share
# NOTE: Must be store in 'DOS' file format convention
; logon script = logon.cmd

# This allows Unix users to be created on the domain controller via the SAMR
# RPC pipe. The example command creates a user account with a disabled Unix
# password; please adapt to your needs
; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u

# This allows machine accounts to be created on the domain controller via the
# SAMR RPC pipe.
# The following assumes a "machines" group exists on the system
; add machine script = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u

# This allows Unix groups to be created on the domain controller via the SAMR
# RPC pipe.
; add group script = /usr/sbin/addgroup --force-badname %g

########## Printing ##########

# If you want to automatically load your printer list rather
# than setting them up individually then you'll need this
# load printers = yes

# lpr(ng) printing. You may wish to override the location of the
# printcap file
; printing = bsd
; printcap name = /etc/printcap

# CUPS printing. See also the cupsaddsmb(8) manpage in the
# cupsys-client package.
; printing = cups
; printcap name = cups

############ Misc ############

# Using the following line enables you to customise your configuration
# on a per machine basis. The %m gets replaced with the netbios name
# of the machine that is connecting
; include = /home/samba/etc/smb.conf.%m

# Most people will find that this option gives better performance.
# See smb.conf(5) and /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/speed.html
# for details
# You may want to add the following on a Linux system:
# SO_RCVBUF=8192 SO_SNDBUF=8192
# socket options = TCP_NODELAY

# The following parameter is useful only if you have the linpopup package
# installed. The samba maintainer and the linpopup maintainer are
# working to ease installation and configuration of linpopup and samba.
; message command = /bin/sh -c '/usr/bin/linpopup "%f" "%m" %s; rm %s' &

# Domain Master specifies Samba to be the Domain Master Browser. If this
# machine will be configured as a BDC (a secondary logon server), you
# must set this to 'no'; otherwise, the default behavior is recommended.
# domain master = auto

# Some defaults for winbind (make sure you're not using the ranges
# for something else.)
; idmap uid = 10000-20000
; idmap gid = 10000-20000
; template shell = /bin/bash

# The following was the default behaviour in sarge,
# but samba upstream reverted the default because it might induce
# performance issues in large organizations.
# See Debian bug #368251 for some of the consequences of *not*
# having this setting and smb.conf(5) for details.
; winbind enum groups = yes
; winbind enum users = yes

# Setup usershare options to enable non-root users to share folders
# with the net usershare command.

# Maximum number of usershare. 0 (default) means that usershare is disabled.
; usershare max shares = 100

# Allow users who've been granted usershare privileges to create
# public shares, not just authenticated ones
usershare allow guests = yes

#======================= Share Definitions =======================

# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user's home directory as \\server\username
;[homes]
; comment = Home Directories
; browseable = no

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
; read only = yes

# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
; create mask = 0700

# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
; directory mask = 0700

# By default, \\server\username shares can be connected to by anyone
# with access to the samba server. Un-comment the following parameter
# to make sure that only "username" can connect to \\server\username
# This might need tweaking when using external authentication schemes
; valid users = %S

# Un-comment the following and create the netlogon directory for Domain Logons
# (you need to configure Samba to act as a domain controller too.)
;[netlogon]
; comment = Network Logon Service
; path = /home/samba/netlogon
; guest ok = yes
; read only = yes
; share modes = no

# Un-comment the following and create the profiles directory to store
# users profiles (see the "logon path" option above)
# (you need to configure Samba to act as a domain controller too.)
# The path below should be writable by all users so that their
# profile directory may be created the first time they log on
;[profiles]
; comment = Users profiles
; path = /home/samba/profiles
; guest ok = no
; browseable = no
; create mask = 0600
; directory mask = 0700

[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700

# Windows clients look for this share name as a source of downloadable
# printer drivers
#[print$]
# comment = Printer Drivers
# path = /var/lib/samba/printers
# browseable = yes
# read only = yes
# guest ok = no
# Uncomment to allow remote administration of Windows print drivers.
# You may need to replace 'lpadmin' with the name of the group your
# admin users are members of.
# Please note that you also need to set appropriate Unix permissions
# to the drivers directory for these users to have write rights in it
; write list = root, @lpadmin

# A sample share for sharing your CD-ROM with others.
;[cdrom]
; comment = Samba server's CD-ROM
; read only = yes
; locking = no
; path = /cdrom
; guest ok = yes

# The next two parameters show how to auto-mount a CD-ROM when the
# cdrom share is accesed. For this to work /etc/fstab must contain
# an entry like this:
#
# /dev/scd0 /cdrom iso9660 defaults,noauto,ro,user 0 0
#
# The CD-ROM gets unmounted automatically after the connection to the
#
# If you don't want to use auto-mounting/unmounting make sure the CD
# is mounted on /cdrom
#
; preexec = /bin/mount /cdrom
; postexec = /bin/umount /cdrom


[ACP]
comment = ACP
path = /home/user/ACP
public = yes
writeable = yes
valid users = user
create mask = 0777
directory mask = 0777
force user = nobody
force group = nogroup


-------------------------------------------------------------------
user@server:~$ ls -h
drwx-xr-x 2 user user 4.0K 2009-12-14 16:30 Desktop
drwx-xr-x 2 user user 4.0K 2009-12-18 16:48 Documents
drwx-xr-x 2 user user 4.0K 2009-12-21 09:44 Downloads
drwxrwxrwx 8 user users 4.oK 2010-2-5 19:25 ACP
user@server:~$
 
Old 02-05-2010, 03:56 AM   #9
amon
Member
 
Registered: May 2004
Location: UK
Distribution: Debian, Ubantu, CentOS
Posts: 146

Rep: Reputation: 17
Hi, for config files etc... it can make life easier for people to read them if you put them in CODE tags (Use the '#' button on the tool bar when editing posts).


This only shows me four directories... Also the permissions for the first three aren't shown properly. Have you modified the output? or perhaps I just need to wait for my morning coffee to take effect.
Code:
user@server:~$ ls -h
drwx-xr-x 2 user user 4.0K 2009-12-14 16:30 Desktop
drwx-xr-x 2 user user 4.0K 2009-12-18 16:48 Documents
drwx-xr-x 2 user user 4.0K 2009-12-21 09:44 Downloads
drwxrwxrwx 8 user users 4.oK 2010-2-5 19:25 ACP
It may help you to look at one of these:
The part of your smb.conf that we are interested in is the Share Definitions This is where shared directories are defined. The comments are very useful.

I have pruned the file to show what I think will be the useful parts. Mostly to do with the file/directory masks (Explained here). These may be the issue.

Code:
#======================= Share Definitions =======================

# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
; create mask = 0700

# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
; directory mask = 0700


[ACP]
comment = ACP
path = /home/user/ACP
public = yes
writeable = yes
valid users = user
create mask = 0777
directory mask = 0777
force user = nobody
force group = nogroup
I assume that APC is the directory you are sharing. In which case can you run the ls -lh command within that directory.

The file writing changing the group is due to there not being a default group. More information on it can be found here: Creating a Samba Shared Workspace

In short I think you will need to change the config for that share to something like:
Code:
[ACP]
comment = ACP
path = /home/user/ACP
public = yes
writeable = yes
valid users = user
create mask = 0777
directory mask = 0777
force user = user
force group = user
This is a bit of a general disclaimer/warning: If this network is shared with people you don't trust 100% it may be worth you checking the samba documents for security.
 
  


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
windows 98 cannot connect to ubuntu samba shared file spikesync Linux - Newbie 6 03-08-2012 08:14 AM
error while loading shared libraries: libstdc++.so.5: cannot open shared object file: Franziss Linux - Newbie 10 06-28-2010 06:47 AM
shared folder/file in ubuntu samba pdelcast Linux - Server 11 04-24-2008 12:38 PM
batch file for accessing a shared file in ubuntu samba pdelcast Linux - Networking 5 04-24-2008 01:21 AM
Stopped due to shared library event - Failed to read a valid object file... tatchan Programming 3 01-16-2007 02:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:49 PM.

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