LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-09-2006, 03:54 AM   #1
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Accessing Windows Shares With Full Permissions


Box 1 is Windows NT4 Workstation. Shares are created with full read-write permissions. Many commonly used data files are stored on this box.

Box 2 is Slackware 10.2/KDE 3.4.3, using Samba 3.0.20.

The system administrator of Box 2 writes a script that is run from rc.local to automatically connect to the shares and mount them to various /mnt mount points. Box 2 is configured to connect and mount the Box 1 shares with full 777 read-write permissions. The gid is set to users and no uid is set. Thus, from the perspective of Box 2, all files on the Box 1 shares are owned by root. Normal users cannot modify any existing file on Box 1, although they can modify any file they personally create on Box 1.

User A, possessing root privileges, decides to remedy this problem and modifies the connection script. The Box 1 shares are now mounted with a uid assigned to User A. Now User A can modify any of those commonly used files on Box 1. User A is happy.

User A decides to take a walk but does not log out, and instead merely locks the X session. After all, this is a multi-user system . User B decides to use Box 2 and logs in at a different console/terminal. User B wants to modify some of those commonly used files on Box 1 but can't because the uid is assigned to User A. Same problem as previously, only a different user now owns the files.

User C later uses Box 2 and experiences the same problem. Users B and C are frustrated and impatiently wait for User A to return from walking.

From the Windows perspective, all users have been granted full permissions to all files, but from the Samba perspective this is not the case. Samba insists upon playing by 'nix rules rather than Windows rules.

How does one connect to a Windows share such that any user can modify any file on those shares, as originally intended from the Windows perspective?
 
Old 01-09-2006, 07:19 AM   #2
heltreko
Member
 
Registered: Mar 2005
Location: Stockholm, Sweden
Distribution: Slackware, Zenwalk
Posts: 141

Rep: Reputation: 15
Hi

Cant you do it by adding a row similar to this in /etc/fstab
Code:
//<windows machine name>/<shared folder>   /<mountpoint>   smbfs   auto,username=<user>,password=<pass>,uid=1000,umask=000,user   0 0
Copyed from http://gentoo-wiki.com/HOWTO_Setup_Samba. I use something similar succesfully on my linux box but can't look right now.

Kind Regards
 
Old 01-09-2006, 12:36 PM   #3
chess
Member
 
Registered: Mar 2002
Location: 127.0.0.1
Distribution: Slackware and OpenBSD
Posts: 740

Rep: Reputation: 190Reputation: 190
For added security, you may wish to keep your username and password locked in a .smbpasswd file and then use the "credentials=" fstab option to reference the .smbpasswd file. Make sure you chmod .smbpasswd 600 otherwise you defeat the whole purpose.

http://www.linuxquestions.org/linux/...k_File_Sharing

see section 3

another reference:

http://www.justlinux.com/nhf/Filesys...rmanently.html
 
Old 01-09-2006, 06:28 PM   #4
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Quote:
Cant you do it by adding a row similar to this in /etc/fstab
Yes, I could, but because my first box is multi-boot, from the perspective of the second box I never "know" which OS I might boot into (Windows or Slackware). Thus, a script that tests which OS is running on that first box is easier. Usually I boot into Windows (NT4), but not always. A script run from rc.local makes more sense.

Quote:
For added security, you may wish to keep your username and password locked in a .smbpasswd file and then use the "credentials=" fstab option to reference the .smbpasswd file. Make sure you chmod .smbpasswd 600 otherwise you defeat the whole purpose.
I do exactly that in my script and already have configured a credentials file. My mounts are automatic from within the script and there are no errors with actually connecting and mounting. At this point I apologize because with hindsight I realize that I posted my question too soon. After further investigation I have additional information to add to this puzzle.

Apparently I can modify files as would be expected by the gid of users. The actual problem is more subtle and initially threw me off-path in my search for an answer.

I have a script in which I copy files from one operating system to another and I use the file date stamp as my means for synchronizing. Originally I used the script only to sync files in my multi-boot box between Windows and Slackware. I used a shared FAT32 partition to move files between the two environments. Worked well.

I then tried using the same script between my two boxes. The original shared FAT32 partition was now a Samba mount point on box two as opposed to a "simple" mount in my multi-boot box.

When I ran this script to sync files between the two boxes, the copying actually was working, but I got fooled for a while thinking otherwise because of the error messages I was receiving. I was using the touch command to modify the file date stamps to ensure files stayed synced. The touch command kept failing and for a while I believed the copy process was failing. In actuality, the copy process worked just fine and only the touch command was failing.

After I understood what was actually happening I performed some additional tests. The touch command, or the cp -p command, will always fail with a Samba mount if the user attempting to use touch or cp -p is not the same user identified as owning the mount point. Hence, the gid option becomes useless with respect to the touch or cp -p commands.

If the user attempting to use touch or cp -p with a Samba mount is the same as that identified by the mount command uid, then the user will be able to successfully perform the commands.

The script worked in my multi-boot box because I mounted the shared FAT32 partition with the uid of my normal login account. Thus, the touch command always succeeded. I had forgotten that tidbit.

In my environment, where I am the sole user of these two particular boxes, I can "cheat" and mount the Windows shares using the uid of my normal login account. That account and root then will have no problem using touch or cp -p. Any additional accounts I create on my box are out of the loop, however.

That latter observation leads me to conclude that in a true multi-user environment, all but two users will always be left out in the cold with respect to modifying file date stamps---although they still can modify files on Windows shares.

Windows does not understand uid and gid in the same sense as does 'nix systems, and Samba should not be enforcing that environment on Windows shares. Even if the mount command needs to create the illusion of a uid and gid, Samba should be ignoring uid if the share is actually a Windows system. If native Windows allows me to modify file date stamps then Samba should honor that system design. And this does not happen.

Although arguably I have a solution available for my personal usage, I try hard to approach my systems from a multi-user perspective. Perhaps my need is peculiar, perhaps not, but regardless, this is a problem in a true multi-user environment.

Does anybody see a valid work-around to this problem?
 
  


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
Accessing Windows Shares careyd Linux - Networking 3 12-01-2005 03:18 PM
Accessing windows shares in GUI kaldenord Fedora 7 02-08-2005 09:52 AM
Accessing Shares from windows z9_87 Linux - Networking 1 02-07-2005 07:35 PM
Accessing Windows Shares haroldopaulino Linux - Networking 1 08-17-2004 11:01 PM
accessing Windows shares on Linux Nachiappan Linux - Networking 2 04-25-2003 01:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:08 AM.

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