The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem syncing logical volume in root vg matt.d UNIX for Advanced & Expert Users 1 04-10-2008 10:12 AM
How to resize mirror volume in veritas volume manager 3.5 on Solaris 9 OE nageswarb SUN Solaris 0 03-14-2008 01:46 PM
LVM - Extending Logical Volume within Volume Group ghimanshu UNIX for Advanced & Expert Users 3 07-26-2007 04:39 AM
files ownership/permission problem jop Linux 1 03-30-2006 12:31 PM
Stubborn file ownership problem! Argh! questor UNIX for Dummies Questions & Answers 0 09-29-2005 06:34 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 07-23-2008
Registered User
 

Join Date: Jul 2008
Posts: 15
Ownership problem using a CIFS-mounted volume

Hello,

I am trying to use a storage service for backing large amounts
(terabytes) of data. The service uses Linux machines and allows
mounting of their disks using the CIFS/SMB protocol.

I do have the option of using rsync directly over the network
without mounting. But in order to automate this process, I do
want to have the remote disk mounted and be able to use cp or
rsync transparently.

The data that needs to be backed up is also on Linux systems. I had
our sys admin set things up on our system so that I can use mount.cifs
command to mount the remote disk like so:

$ mkdir -p /tmp/sam_test3
$ mount.cifs //brick.orgname.org/test3 /tmp/sam_test3 -o
user=test3, uid=sam, gid=swdevelopers, file_mode=0775,
dir_mode=0775

where the remote username (on brick) is 'test3' and my local username
is on our system is 'sam'. By the way, 'test3' is also a member of a
group with the same name 'test3'. That group has w/x permissions on
/tmp/sam_test3.

The mounting command above works fine: After entering my remote user
password, the disk is successfully mounted, but it changes owner and
gid to 'test3'.

The problem is to write to that mounted dir from my local machine on
which I'm logged in as 'sam'. Since I'm not the owner of
/tmp/sam_test3 and I don't belong to the group 'test3', I can't
write to it.

It would seem that the way to solve this would be to add my local
username, 'sam' to the group 'test3' on the remote machine. But this
is what the admin for the remote machine brick told me.

> I think that is going to be UID based, and not name based so adding
> the name will likely not help as the UID between machines is going to
> be different.

Is there anyone with in-depth knowledge of CIFS and the mount.cifs
command who can suggest a way around the ownership permissions
problems.

He also suggested that smbmount doesn't have the same problem.
(If that's true, why not?)

Thank you in advance to whomever can give me some suggestions,

Sam
Reply With Quote
Forum Sponsor
  #2  
Old 07-23-2008
mph mph is offline
Registered User
 

Join Date: Mar 2006
Posts: 44
You can use rsync transparently, sort of... That is, if what your looking for is automation, rsync can do it. It's been a couple of years since I did this but I'll take a poke at it.
Setup the variables in a script something like this:
Code:
CFGFILE=/etc/rsyncd.conf
LOGFILE="log file = \/var\/log\/rsync.log"
RUID="uid = 0"
RGID="gid = 0"
AUTHUSR="auth users = root"

You can use either:
PASSWD="root:passwd" (Not roots real password, but one you make up on both boxes for root to use).
Or:
SECRETS="secrets file = \/etc\/rsyncd.secrets" (Make this readable by root only -r--------) This is more secure as
 variables may sometimes be seen by others if exported.  Also it's more secure than using the mount command as 
you'd have to put the user name and password in it for automating the mounting / unmounting of the file systems 
anyway.
In your script you would use something like this:
Code:
rsync -av $EXCLUDES --delete root@$MACH::root/ $BASEDIR/$MACH/full/ \
        2>> $BASEDIR/$MACH/log/$MACH-full-$DATE-error.log \
        | tee -a $BASEDIR/$MACH/log/$MACH-full-$DATE.log
I at one time had a script for backing up several Linux boxes all of which had different configurations as far as excluded files, etc...(this will explain some of the above variables)
Each file contained something like this:
Code:
MACH=unix1
USR=root
OSTYPE=linux
EXCLUDES="--exclude /sys --exclude /initrd/proc --exclude /dev/pts --exclude /proc --exclude /mnt"
The above is set for a full backup. You can also setup sub directories for differentials between full backups. Set up your script to run in cron... and away you go!

Hope this helps.

M.P.H.
Reply With Quote
  #3  
Old 07-24-2008
Registered User
 

Join Date: Jul 2008
Posts: 15
RE: Ownership problem using a CIFS-mounted volume

Hi M.P.H,

Thanks much for your suggestion. I will run it by my sys admin. But you're right, I don't care about doing mount if I can automate without it.

I'm not a Linux expert so I'll need a little time to digest what you've shown me.

Do I need root priviledges to implement this rsync script? (it looks like I do but I'm not sure).

Thanks,
Sam
Reply With Quote
  #4  
Old 07-24-2008
mph mph is offline
Registered User
 

Join Date: Mar 2006
Posts: 44
No, well that depends on the permissions on the local and remote server.
If you have wrx on both machines for the directories involved, then you don't need root
access. You would use your login in place of 'root'. What I gave you there was the very
least in variables, code, and configuration for multiple machines.

See what you can come up with on your own. I'll be more than happy to post a bit more of
what I have and the logic behind it as needed.

MPH
Reply With Quote
  #5  
Old 07-25-2008
Registered User
 

Join Date: Jul 2008
Posts: 15
Ok thanks. I'll see what I can do with this.

Sam
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 01:23 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0