FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 03-03-2009, 12:52 PM
Chris Jones
 
Default USB mounting automatically : users option?

Hi,

> Is it possible to ensure that the files on the device will be readable
> and writable by the user who mounted the USB drive?
>
> I have done the following, and it may be working:
>
> 1. mkdir /media/BLUE
> 2. labelled the USB drive "BLUE"
> 3. chmod 777 /media/BLUE
> 4. in fstab:
> ####USB BLUE
> LABEL=BLUE /media/BLUE ext2 defaults,users,rw,auto 0 0
>
> So far so good. I am not sure this is doing what I want, however, as I
> still see the owner of some files as "1000".

1000 was presumably the UID of your user account on the machine where
you created the file ? The fact that you are seeing 1000 as the user on
the second system means that you don't have a user on that system using
UID=1000 (and thus your account on this machine has a different UID ?)

In a similar situation I found the best approach was to arrange to make
sure I have the same UID for all the accounts I use on different
systems. When accounts are created the UID is normally automatically
assigned, but it is possible to choose it by hand. Of course, if some
other account is already using the UID you want, you are out of luck.
IIf you can do this though then you will naturally have the same
permissions on all machines where you mount the drive, and thus it is
the most elegant solution I think.

If this is not possible, then you could make the files on the drive rw
for all users. e.g.

> cd /path/to/external/drive
> chmod -R a+wr *

This is not as elegant, but might be your best alternative.

cheers Chris


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-03-2009, 01:37 PM
Brian McKee
 
Default USB mounting automatically : users option?

On Tue, Mar 3, 2009 at 6:30 AM, Alan E. Davis <lngndvs@gmail.com> wrote:
> I have a git repository on a USB flash drive.* Two or more users (all of
> them me, at this point) on various machines need to have read and write
> permissions on this repository.* I have run into problems due to different
> user numbers, as the owners and groups on the USB drive are numbers only,
> unless originating on the machine the drive is mounted on.* I think this is
> how it works.

Owners and groups are actually numbers UIDs and GIDs - always. The
text is just a label for humans.
So, if a file is owned by user 500, it checks the /etc/passwd file,
and sees user 500 has name 'fred' and displays 'fred' on the screen.
If you take that drive to another computer that doesn't have a user
500, it just prints 500. If that other computer has a user 500 called
john - it prints John on the screen.

Perhaps it would be helpful to create a group called 'gitusers' or
something, with a specified group number of say 5555 or whatever on
every computer you want to hook that drive up to.

Brian

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-03-2009, 09:19 PM
Chris Jones
 
Default USB mounting automatically : users option?

>> Hi,

>
> Owners and groups are actually numbers UIDs and GIDs - always. The
> text is just a label for humans.
> So, if a file is owned by user 500, it checks the /etc/passwd file,
> and sees user 500 has name 'fred' and displays 'fred' on the screen.
> If you take that drive to another computer that doesn't have a user
> 500, it just prints 500. If that other computer has a user 500 called
> john - it prints John on the screen.

Thats essentially what I was trying to say, only put a little better.

Another point worth making is a file 'owned' by fred on the first
system will be 'owned' by john on the second. As you say, the file
system doesn't care about user names, only user IDs.

Chris

>
>
> Perhaps it would be helpful to create a group called 'gitusers' or
> something, with a specified group number of say 5555 or whatever on
> every computer you want to hook that drive up to.
>
> Brian
>
> --
> ubuntu-users mailing list
> ubuntu-users@lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-03-2009, 10:26 PM
Cameron Hutchison
 
Default USB mounting automatically : users option?

"Alan E. Davis" <lngndvs@gmail.com> writes:

>Is it possible to ensure that the files on the device will be readable and
>writable by the user who mounted the USB drive?

If it is a FAT filesystem or other filesystem that does not store the
user and group ID, then the user and group on the files must be chosen
at mount time, and all files on the filesystem get those IDs.

>I have done the following, and it may be working:

> 4. in fstab:
> ####USB BLUE
> LABEL=BLUE /media/BLUE ext2 defaults,users,rw,auto 0 0

However, since you are using ext2, the user and group IDs are stored by
the filesystem so there is no remapping of IDs when the volume is
mounted.

The only way around this is to synchronise the IDs on the different
machines. You can get away with using a GID in common and ensuring that
all the files use that group ID and have group rw[x] permissions. That
way, your owners can be different but the files still fully accessible
on each machine.

You will probably want want to use set-gid directories and a umask of
00X (X is usually 2 or 7). This means the files you create are group
writable (umask) and new files inherit the GID of the directory they are
in (set-gid directories).


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-04-2009, 06:11 AM
"Alan E. Davis"
 
Default USB mounting automatically : users option?

These responses are very helpful.* It seems I am on the right track.* I did manually assign a user a specific UID today upon creation of the user, and that did confirm these ideas: the files are now seen as owned by any user on the current system with that UID number.*


It's a minor annoyance but it will work.* The "git" group with GID 1111 is working ok, but I am not sure how to ensure than other users are writing files only with group write permissions set.

Is this what a sticky bit is?


On Wed, Mar 4, 2009 at 9:26 AM, Cameron Hutchison <lists@xdna.net> wrote:

"Alan E. Davis" <lngndvs@gmail.com> writes:



> *4. in fstab:

> * * * *####USB BLUE

> * * * *LABEL=BLUE /media/BLUE ext2 defaults,users,rw,auto 0 0


I am sorry to say that this experiment failed.* On this Intrepid Ibex Ubuntu system, when I explicitly created a mount point /media/BLUE and included this line in /etc/fstab, that partition (BLUE) ends up being mounted twice.* I am told to use "user" instead of "users".* I don't know how to set that up for automounting.* WHen I include that line in /etc/fstab but /media/BLUE isn't present, plugging in the USB drive throws an* error.*

** * * * * ** since you are using ext2, the user and group IDs are stored by

the filesystem so there is no remapping of IDs when the volume is

mounted.
Aha! *




The only way around this is to synchronise the IDs on the different

machines. You can get away with using a GID in common and ensuring that

all the files use that group ID and have group rw[x] permissions.
This is an opportunity to learn to control the permissions.**





You will probably want want to use set-gid directories and a umask of

00X (X is usually 2 or 7). This means the files you create are group

writable (umask) and new files inherit the GID of the directory they are

in (set-gid directories).
This is the big question, then: how can I set a set-gid directory?* Google time.* In a couple of hours I can shuffle around users on the system.* Easier if it's automatic.*


Thank you, very much.

Alan*


--
Alan Davis

"An inviscid theory of flow renders the screw useless, but the need for one non-existent." * * * * * * * * * * ---Lord Raleigh (John William Strutt), or else his son, who was also a scientist.


It is undesirable to believe a proposition when
there is no ground whatsoever for supposing it is true.
* * ---- Bertrand Russell



--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 01:35 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org