Permissions on autofs mounted drives

Hi,

I have auto mounted remote disks using autofs. The problem is that now I don’t have write access to these disks. There is no authentication to access them. Another guy here at work can write to them from Ubuntu. He said that you need to modify your UID to get write access, but that it’s really tricky… can anyone direct me on how to do it?

The reason I can’t write to it is because the files are part of the cdrom user group. I have added myself to that group but that doesn’t make any difference. I don’t know why the files get loaded as part of that user… Any ideas greatly appreciated

/jlar

The root folder that has been mounted is owned by root.

Anyone??? I could use OpenSuse at work full time if I can get this going… :slight_smile:

I have a dual boot of XP/OpenSuse. I can write to the drive from XP, but not OpenSuse ???

First of all you describe your environment in a more clear way.
“automount remote disks”
What do you mean by this?
Are you mounting disk partitions from another machine?
If so, how? Is that remote machine a non-Linux machine? Windo$?
How did you mount it?
Or, is it another Linux machine?
Are you using NFS or SAMBA or something else?

Hi,
Thanks for your reply…

First of all you describe your environment in a more clear way.
“automount remote disks”
What do you mean by this?

I am mounting a set of disks which are behind an NFS Gateway. They are not tied any particular OS, and are accessible from Windows and Unix clients. When I log into a Solaris box, my /home is on this remote disk, and if I map a network drive in Windows, it’s also on this disk.

Are you mounting disk partitions from another machine?

(?) With autofs the server makes the disks available to clients, so no I think is the answer to this.

If so, how? Is that remote machine a non-Linux machine? Windo$?

It’s an NFS Server, I don’t know whether it is Windows/Linux/Unix

How did you mount it?

I am using autofs. This is my auto.master file:

#
# Sample auto.master file
# This is an automounter map and it has the following format
# key  -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
#/misc  /etc/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
#       "nosuid" and "nodev" options unless the "suid" and "dev"
#       options are explicitly given.
#
/net    -hosts     uid=1000,gid=1000
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
# /net  /etc/auto.net --timeout 60
+auto.master

When I log in it automatically mounts everything in /etc/hosts, the remote disks are mounted under /net.

The service is running:

/etc/init.d/autofs status
Checking for service automount                                                                                                 running

The disks are mounted, I checked the /net directory.

Or, is it another Linux machine?

No, it’s not another Linux machine.

Are you using NFS or SAMBA or something else?

NFS

I think you need to hack the user id in someway to get read/write access…

If I do

cat /proc/mounts

It has this signature:

-hosts /net/mysterious/remote/disk autofs rw,fd=5,pgrp=4749,timeout=600,minproto=5,maxproto=5,offset 0 0

NFS assumes that you have the same UID/GID the at server as well as at the client side.
In my knowledge, the file system exported at the server side determines the UID/GID.
What UID/GID do you see on the files when mounted at the client side?
Can post the output of “ls -l” there?

Oh no… it’s root. Does that mean I have to be root to write to the file system?


total 4
drwxr-xr-x 22 root root 4096 2009-06-18 11:52 ..
dr-xr-xr-x  2 root root    0 2009-06-18 11:53 localhost
dr-xr-xr-x  2 root root    0 2009-06-18 11:53 xxxx-xxxx.xxxx
drwxr-xr-x  5 root root    0 2009-06-18 12:10 .
dr-xr-xr-x  4 root root    0 2009-06-18 12:47 read_only_folder


Don’t you have any control over this NFS gateway? You are saying when you log in to Solaris, this become your home there. What file permission/ownership you see there?
But, that mounted directory (/net) doesn’t look like a Solaris home directory?

Files which I write to from windows also have this user:

drwxr-xr-x 2 1621 cdrom 4096 2009-06-18 14:16 .
drwxr-xr-x 9 1621 cdrom 4096 2009-06-09 14:29 …

No I don’t have control over the NFS Gateway. When I log into Solaris my home directory looks like this (note this is only a partial listing):


drwx------   3 johnl    staff       4096 Nov  5  2008 .sunw            
drwxr-xr-x   4 johnl    staff       4096 Nov 18  2008 .cpan            
-rwxr-xr-x   1 johnl    staff       5111 Nov 25  2008 .dtprofile       
drwx------   2 johnl    staff       4096 Nov 25  2008 .wastebasket     
drwx------   3 johnl    staff       4096 Nov 25  2008 .fm              
-rw-r--r--   1 johnl    staff        977 Nov 25  2008 .desksetdefaults 
drwx------   2 johnl    staff       4096 Nov 26  2008 .gnome2_private  
drwx------   4 johnl    staff       4096 Nov 26  2008 .gnome           
drwx------   3 johnl    staff       4096 Nov 26  2008 .metacity        
drwxr-xr-x   2 johnl    staff       4096 Nov 26  2008 Desktop          
drwxr-xr-x   3 johnl    staff       4096 Nov 26  2008 .nautilus        
-rw-------   1 johnl    staff          0 Nov 26  2008 .recently-used   
drwxr-xr-x   3 johnl    staff       4096 Nov 26  2008 .softwareupdate  
drwx------   2 johnl    staff       4096 Dec  4  2008 .solregis        
drwx------   3 johnl    staff       4096 Dec  4  2008 .mozilla         
drwxr-xr-x   2 johnl    staff       4096 Dec  4  2008 .icons           
-rw-r--r--   1 johnl    staff        111 Dec 15  2008 .gtkrc-1.2-gnome2
drwx------   7 johnl    staff       4096 Dec 15  2008 .gnome2          
-rw-------   1 johnl    staff         14 Jan 13 12:19 .sh_history 

Ok, but if I look at the same directory when it’s mounted by autofs, it looks like this:


drwx------  3 1621 wheel  4096 2008-11-05 10:54 .sunw
drwxr-xr-x  4 1621 wheel  4096 2008-11-18 11:08 .cpan
-rwxr-xr-x  1 1621 wheel  5111 2008-11-25 14:26 .dtprofile
drwx------  2 1621 wheel  4096 2008-11-25 14:26 .wastebasket
drwx------  3 1621 wheel  4096 2008-11-25 14:26 .fm
-rw-r--r--  1 1621 wheel   977 2008-11-25 14:27 .desksetdefaults
drwx------  2 1621 wheel  4096 2008-11-26 17:15 .gnome2_private
drwx------  4 1621 wheel  4096 2008-11-26 17:15 .gnome
drwx------  3 1621 wheel  4096 2008-11-26 17:15 .metacity
drwxr-xr-x  2 1621 wheel  4096 2008-11-26 17:15 Desktop
drwxr-xr-x  3 1621 wheel  4096 2008-11-26 17:15 .nautilus
-rw-------  1 1621 wheel     0 2008-11-26 17:15 .recently-used
drwxr-xr-x  3 1621 wheel  4096 2008-11-26 17:15 .softwareupdate
drwx------  2 1621 wheel  4096 2008-12-04 13:24 .solregis
drwx------  3 1621 wheel  4096 2008-12-04 13:28 .mozilla
drwxr-xr-x  2 1621 wheel  4096 2008-12-04 13:28 .icons
-rw-r--r--  1 1621 cdrom   111 2008-12-15 16:12 .gtkrc-1.2-gnome2
drwx------  7 1621 wheel  4096 2008-12-15 16:12 .gnome2
-rw-------  1 1621 cdrom    14 2009-01-13 12:19 .sh_history

I can write to this directory from Windows, but not from Linux

You have a login named “johnl” in Solaris with id = 1621. The exported partition was created for that user.
When you mount this under Linux, you need to be a user with id = 1621.
You can drop and recreate your login with this id.

Hi,

I changed my userid to 1621 and now I can write to the disk… Thanks very much. I have been trying to get this to work for months. This is just fantastic! :slight_smile:

/jlar

Nice to hear that your problem is solved.